my_t.test: t-test

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 = "two.sided", mu = 0)

Arguments

x

Numeric vector of data comprising sample values.

alternative

String specifying the alternative hypothesis, can be one of three values: less, two.sided, or greater.

mu

The numeric mean of the null hypothesis.

Value

A list comprised of the following: test_stat (the numeric test statistic), df (the degrees of freedom), alternative (a string representing the alternative hypothesis), and p_val (the numeric p-value).

Examples

1
2
3
my_t.test(rnorm(100, mean = 0, sd = 1), alternative = "less", mu = 0)
my_t.test(rnorm(100, mean = 0, sd = 1), alternative = "greater")
my_t.test(rnorm(100, mean = 0, sd = 1))

smokingcrater/STAT302Package documentation built on Dec. 23, 2021, 3:27 a.m.