APA_Table: Regressions Tabelle

Description Usage Arguments Value Examples

View source: R/regression-typ3.R

Description

APA_Table(..., type="long") ist ein Workaround von texreg

include.pseudo = FALSE Preudo R

Cox und Snell R2: [ 0.2 = akzeptabel, 0.4 = gut ]

Nagelkerke R2: [ 0.2 = akzeptabel, 0.4 = gut, 0.5 = sehr gut]

McFaddens R2: [ 0.2 = akzeptabel, 0.4 = gut ]

include.ftest = FALSE noch nicht fertig include.loglik = FALSE noch nicht fertig

include.CI=FALSE leicht unterschiedlich zu confint texreg berechnet <c3><bc>ber die SE und qnorm (Normal Distribution) confint bei lm <c3><bc>ber qt (student-T-Distribution)

z = qnorm(1 - ((1 - ci.level)/2)) coef + (z * se) und coef - (z * se)

rgroup = c("Parameter", "Goodness of fit") col_names = c("b", "SE", "p")

Erstellt APA-Style Tabellen aus R-Objekten (lm, glm,lmer, usw).

type="default" Formatierung als breite Tabelle

type="texreg" Long-Format Kopie der texreg Funktion

type="starganzer" Stargazer kann nicht mit LmerTest arbeiten.

type="long" Lang-Format Tabelle

type="anova" Anova (car::Anova) Funktionen aus APA_Table(..., include.anova=TRUE)

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
regression_output(fits, caption = "", note = "",
  custom.model.names = NULL, digits = 2, p.value = TRUE,
  col_names = NULL, rgroup = c("Parameter", "Goodness of fit"),
  include.pseudo = FALSE, include.ftest = FALSE,
  include.loglik = FALSE, include.CI = FALSE, ...)

APA_Table(..., caption = NULL, note = NULL,
  output = stp25output::which_output(), type = c("default", "long",
  "long2", "broom", "texreg", "stargazer", "sjPlot", "anova"),
  names = NULL, custom.model.names = NULL, digits = NULL,
  include.b = TRUE, include.se = TRUE, include.t = FALSE,
  include.beta = FALSE, include.odds = FALSE, include.ci = FALSE,
  include.odds.ci = FALSE, include.p = FALSE, include.stars = if
  (include.p) FALSE else TRUE, include.variance = TRUE,
  include.r = TRUE, include.pseudo = FALSE, include.ftest = FALSE,
  include.loglik = FALSE, include.custom = NULL, include.aic = TRUE,
  include.bic = include.aic, include.anova = FALSE,
  include.sumsq = TRUE, include.meansq = FALSE, include.eta = FALSE,
  include.gof = TRUE, include.param = TRUE, ci.level = 0.95,
  single.row = TRUE, rgroup = c("Parameter", "Goodness of fit"),
  test.my.fun = FALSE, include.effects = c("ran_pars", "fixed"),
  include.statistic = FALSE, include.test = FALSE, conf.int = TRUE,
  conf.level = 0.95, conf.method = "Wald", fix_format = FALSE,
  digits.param = 3, digits.odds = 2, digits.test = 2,
  digits.beta = 2, format = "fg")

type_default(x, caption = NULL, output = NA, note = NULL,
  custom.model.names = NULL, test.my.fun = FALSE, ...)

type_texreg(list, caption = "", note = "", output = NA,
  names = NULL, digits = 2, single.row = TRUE,
  include.stars = TRUE, include.p = FALSE, ci.force = FALSE,
  include.variance = TRUE, custom.model.names = if (is.null(names))
  paste0("(", 1:length(list), ")") else names,
  center = options()$stp25$apa.style$center,
  stars = options()$stp25$apa.style$p$stars.value,
  stars.symbols = options()$stp25$apa.style$p$stars.symbols)

type_stargazer(list, caption, digits)

type_long(...)

APA_Table_Anova(myfits, caption = "Anova", note = NULL,
  output = stp25output::which_output(), names = NULL,
  include.eta = TRUE, include.sumsq = TRUE, include.meansq = FALSE,
  ...)

Arguments

caption, note, names, custom.model.names, rgroup

rgroup:ype="long" long die Zwischenueberschrift Beschriftung

digits

Kommastellen auch als Matrix bei type =long

include.ftest, include.loglik

noch nicht fertig

...

Modelle

type

type = c("default", "broom","long", "texreg", "stargazer", "sjPlot","anova")

include.b, include.se, include.beta, include.odds

Parameter, b=estimate, OR exp(b)

include.ci, ci.level

95-CI

include.p, include.stars

Sternchen und P-Werte

include.variance

Variance

include.r, include.pseudo

R-Quadrat

include.custom

Liste mit eigenen Eintr<c3><a4>gen

include.aic, include.bic

AIC BIC

include.anova

Explizite ANOVA Tabelle include.anova=TRUE

include.eta

Eta bei Anova

single.row

Agrument texreg = TRUE

Value

invisible data.frame und Output mit html/knit oder Text.

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
 
##library(stp25data)
##Projekt("html")
summary(schools)
##Head("Lineare-Regression lm")
lm1<-lm(score ~ grade + treatment + stdTest, schools)
#   type = c("default", "broom", "c", "c", "sjPlot","anova")
APA_Table(lm1, caption="default/broom")

APA_Table(lm1, type="texreg", caption="texreg")
APA_Table(lm1, type="stargazer", caption="stargazer")
APA_Table(lm1, type="sjPlot", caption="sjPlot")
APA_Table(lm1, type="anova", caption="anova")


##Head("Lineare-Mixed-Effect-Regression")
Text("
     # lme4
     lmer(y ~ 1 + (1 | subjects), data=data)

     # nlme
     lme(y ~ 1, random = ~ 1 | subjects, data=data)

     ")

##Head("nlme::lme", style=3)
lme1<-nlme::lme(score ~  grade +treatment  + stdTest , schools, random =~ 1|classroom)


APA_Table(lme1, caption="default/broom")
APA_Table(lme1, type="texreg", caption="texreg")
APA_Table(lme1, type="stargazer", caption="stargazer")
APA_Table(lme1, type="sjPlot", caption="sjPlot")
APA_Table(lme1, type="anova", caption="anova")



##Head("lmerTest::lmer", style=3)
lmer11<-lmerTest::lmer(score ~  grade +treatment  + stdTest + (1|classroom), schools)

APA_Table(lmer11, caption="default/broom")
APA_Table(lmer11, type="texreg", caption="texreg")
APA_Table(lmer11, type="stargazer", caption="stargazer")
APA_Table(lmer11, type="sjPlot", caption="sjPlot")
APA_Table(lmer11, type="anova", caption="anova")

##Head("lme4::lmer", style=3)
lmer12<-lme4::lmer(score ~  grade +treatment  + stdTest + (1|classroom), schools)
APA_Table(lmer12, caption="default/broom")
APA_Table(lmer12, type="texreg", caption="texreg")
APA_Table(lmer12, type="stargazer", caption="stargazer")
APA_Table(lmer12, type="sjPlot", caption="sjPlot")
APA_Table(lmer12, type="anova", caption="anova")

nms<-  c("lm", "lme", "lmerTest", "lme4")
# APA_Table(lm1, lmer11, lmer12, caption="default/broom")
APA_Table(lm1, lme1, lmer11, lmer12, type="texreg", caption="texreg", names=nms)
APA_Table(lm1, lme1,  lmer12, type="stargazer", caption="stargazer", names=nms[-3])
APA_Table(lm1, lme1, lmer11, lmer12, type="sjPlot", caption="sjPlot", names=nms)
APA_Table(lm1, lme1, lmer11, lmer12, type="anova", caption="anova", names=nms)

R2(lm1)
R2(lme1)
R2(lmer11)
R2(lmer12)

# texreg::extract(lm1)
# texreg::extract(lme1)
# texreg::extract(lmer11, include.pseudors = F, include.loglik = TRUE  )
# str(texreg::extract(lmer12))
#car::vif(fit)
#VIF(fit)

##Head("Block Lineare-Mixed-Effect-Regression")

sleepstudy<- lme4::sleepstudy
fm1 <- lme4::lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
fm2 <- lmerTest::lmer(Reaction ~ Days + (Days || Subject), sleepstudy)
APA_Table(fm1, fm2)
APA_Table(fm1, fm2, type="tex")


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




APA2(list(fit1, fit2))
APA_Table(fit1, fit2,
          type = "long",
          # rgroup = c("Parameter2", "Goodness of fit"),
          include.custom = list(Wald = c(
            APA(fit1, include.r = FALSE),
            APA(fit2, include.r = FALSE)
          ))
          
)


#End()

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