library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(rempsyc)
## Suggested APA citation: Thériault, R. (2023). rempsyc: Convenience functions for psychology. 
## Journal of Open Source Software, 8(87), 5466. https://doi.org/10.21105/joss.05466

t.test

t.test<-nice_t_test(data=mtcars,response = names(mtcars)[1:6],group = "am",warning=FALSE)
## Using Welch t-test (base R's default; cf. https://doi.org/10.5334/irsp.82).
## For the Student t-test, use `var.equal = TRUE`. 
## 
t.test

Benferroni correlation

nice_t_test(data=mtcars,response = names(mtcars)[1:6],group = "am",correlation="bonferroni",warning=FALSE)
## Using Welch t-test (base R's default; cf. https://doi.org/10.5334/irsp.82).
## For the Student t-test, use `var.equal = TRUE`. 
## 

APA TABLE

nice_table(t.test)

Dependent Variable

t

df

p

d

95% CI

mpg

-3.77

18.33

.001**

-1.48

[-2.27, -0.67]

cyl

3.35

25.85

.002**

1.21

[0.43, 1.97]

disp

4.20

29.26

< .001***

1.45

[0.64, 2.23]

hp

1.27

18.72

.221

0.49

[-0.23, 1.21]

drat

-5.65

27.20

< .001***

-2.00

[-2.86, -1.12]

wt

5.49

29.23

< .001***

1.89

[1.03, 2.73]

nice_table(t.test,highlight = T)

Dependent Variable

t

df

p

d

95% CI

mpg

-3.77

18.33

.001**

-1.48

[-2.27, -0.67]

cyl

3.35

25.85

.002**

1.21

[0.43, 1.97]

disp

4.20

29.26

< .001***

1.45

[0.64, 2.23]

hp

1.27

18.72

.221

0.49

[-0.23, 1.21]

drat

-5.65

27.20

< .001***

-2.00

[-2.86, -1.12]

wt

5.49

29.23

< .001***

1.89

[1.03, 2.73]

SAVE TO WORD DOC

table_1<-nice_table(t.test)
#save_as_docx(table_1,path="t-test.docx")

liner regression

names(mtcars)
##  [1] "mpg"  "cyl"  "disp" "hp"   "drat" "wt"   "qsec" "vs"   "am"   "gear"
## [11] "carb"
model<-lm(mpg~wt*cyl+gear,data=mtcars)
nice_table(nice_assumptions(model),col.format.p = 2:4)

Model

Normality (Shapiro-Wilk)

Homoscedasticity (Breusch-Pagan)

Autocorrelation of residuals (Durbin-Watson)

Diagnostic

mpg ~ wt * cyl + gear

.615

.054

.525

0.00

nice_table(nice_lm(model,b.label = "B"))
## The argument 'b.label' is deprecated. If your data is standardized, capital B will be used automatically. Else, please use argument 'standardize' directly instead.

Dependent Variable

Predictor

df

b*

t

p

sr2

95% CI

mpg

wt

27

-8.77

-3.73

.001***

.07

[0.00, 0.15]

cyl

27

-3.79

-3.73

.001***

.07

[0.00, 0.15]

gear

27

-0.45

-0.62

.540

.00

[0.00, 0.01]

wt × cyl

27

0.80

2.41

.023*

.03

[0.00, 0.08]