my_t_test: T-test

View source: R/my_t_test.R

my_t_testR Documentation

T-test

Description

Performs a one sample t-test on vectors of data.

Usage

my_t_test(data, mu, alt = "two.sided")

Arguments

data

A numeric vector of data.

mu

A number indicating the null hypothesis value of the mean.

alt

A character string specifying the alternative hypothesis, must be one of the "two.sided (default)", "less", or "greater".

Value

A list containing the following components:

  • test_stat: the numeric test statistic;

  • df: the degrees of freedom;

  • alternative: the value of the parameter alternative;

  • p_val: the numeric p-value.

Examples

my_t_test(1:10, mu = 5, alt = "greater")

# my_t_test on a normal distribution data
test <- rnorm(10, mean = 1, sd = 0)
my_t_test(test, 0, "two.sided")


yinuotxie/package302 documentation built on April 29, 2023, 7:13 a.m.