Learn R Programming

ISCAM (version 1.0.0)

iscamonesamplet: One Sample T-Test

Description

onesamplet calculates a one sample t-test and/or interval from summary statistics. It defaults to a hypothesized population mean of 0. You can optionally set an alternative hypothesis and confidence level for a two-sided confidence interval.

Usage

iscamonesamplet(
  xbar,
  sd,
  n,
  hypothesized = 0,
  alternative = NULL,
  conf.level = NULL,
  verbose = TRUE
)

Value

The t value, p value, and confidence interval.

Arguments

xbar

Observed mean.

sd

Observed standard deviation.

n

Sample size.

hypothesized

Hypothesized population mean.

alternative

"less", "greater", or "two.sided"

conf.level

Confidence level.

verbose

Logical, defaults to TRUE. Set to FALSE to suppress messages

Examples

Run this code
iscamonesamplet(
  xbar = 2.5,
  sd = 1.2,
  n = 30,
  alternative = "greater",
  hypothesized = 2
)
iscamonesamplet(
  xbar = 10.3,
  sd = 2,
  n = 50,
  alternative = "less",
  hypothesized = 11
)
iscamonesamplet(
  xbar = 98.2,
  sd = 2,
  n = 100,
  alternative = "two.sided",
  conf.level = 0.95
)
iscamonesamplet(xbar = 55, sd = 5, n = 40, conf.level = 0.99)

Run the code above in your browser using DataLab