one.sample.z: One sample z-test

View source: R/one.sample.z.R

one.sample.zR Documentation

One sample z-test

Description

Provides a one-sample hypothesis test. The test assumes that the underlying population is normal and furthermore that \sigma is known.

Usage

one.sample.z(data = NULL, null.mu = 0, xbar = NULL, sigma, n = NULL, 
alternative = "two.sided", conf = 0.95, na.rm = FALSE, fpc = FALSE, N = NULL)

Arguments

data

A vector of quantitative data. Not required if xbar and n are supplied by the user.

null.mu

The expectation for the null distribution.

xbar

Sample mean. Not required if is.null(data)==FALSE

sigma

The null distribution standard deviation

n

The sample size. Not required if is.null(data)==FALSE

alternative

Type of test. One of three must be specified "two.sided", "less", or "greater"

conf

Confidence level.

na.rm

Logical, indicate whether NA values should be stripped before the computation proceeds.

fpc

A logical statement specifying whether a finite population correction should be made. If fpc = TRUE the population size N must be specified.

N

The population size. Required if fpc=TRUE

Details

The function can use either raw data is.null(data)==FALSE or summarized data if is.null(data)==TRUE. With the later xbar and n must be specified by the user.

Value

Returns a test statistic and a p-value.

Author(s)

Ken Aho. Thanks to Anderson Canteli for identifying a bug in the function for asbio versions < 1.9-6.

See Also

pnorm

Examples

one.sample.z(null.mu = 131, xbar = 126, sigma = 12, n = 85, alternative = "two.sided")

asbio documentation built on May 29, 2024, 5:57 a.m.