my_t.test: One-sample t-test function

Description Usage Arguments Value Examples

View source: R/my_t.test.R

Description

This function performs a one-sample t-test.

Usage

1
my_t.test(x, alternative, mu)

Arguments

x

A numeric vector of data.

alternative

A character string specifying the alternative hypothesis, should only be "two.sided", "less", or "greater".

mu

A number indicating the null hypothesis value of the mean.

Value

A list containing four elements: test_stat (the numeric test, test statistic), df (the degrees of freedom), alternative (the value of the parameter "alternative"), and p_val (the numeric p-value).

Examples

1
2
3
my_t.test(x = rnorm(100, 0, 1), alternative = "two.sided", mu = 0)
my_t.test(x = runif(20, 5, 3), alternative = "less", mu = 4)
my_t.test(x = rbinom(70, 6, 0.75), alternative = "greater", mu = 2)

CamSims/myfirstpackage documentation built on Dec. 17, 2021, 1:56 p.m.