nhst {quest}R Documentation

Null Hypothesis Significance Testing

Description

nhst computes the statistical information for null hypothesis significance testing (NHST), t-values, p-values, etc., from parameter estimates, standard errors, and degrees of freedom. If degrees of freedom are not applicable or available, then df can be set to Inf (the default) and z-values rather than t-values will be computed.

Usage

nhst(est, se, df = Inf, ci.level = 0.95, p.value = "two.sided")

Arguments

est

numeric vector of parameter estimates.

se

numeric vector of standard errors. Must be the same length as est.

df

numeric vector of degrees of freedom. Must be length of 1 or have same length as est and se. If degrees of freedom are not applicable or available, then df can be set to Inf (the default) and z-values rather than t-values will be computed. Note, df can be non-integers with decimals.

ci.level

double vector of length 1 specifying the confidence level. Must be between 0 and 1 - or can be NULL in which case no confidence intervals are computed and the return object does not have the columns "lwr" or "upr".

p.value

character vector of length 1 specifying the type of p-values to compute. The options are 1) "two.sided" which computed non-directional, two-tailed p-values, 2) "less", which computes negative-directional, one-tailed p-values, or 3) "greater", which computes positive-directional, one-tailed p-values.

Value

data.frame with nrow equal to the lengths of est and se. The rownames are taken from est, unless est does not have any names and then the rownames are taken from the names of se. If neither have names, then the rownames are automatic (i.e., 1:nrow()). The columns are the following:

est

parameter estimates

se

standard errors

t

t-values (z-values if df = Inf)

df

degrees of freedom

p

p-values

lwr

lower bound of the confidence intervals (excluded if ci.level = NULL)

upr

upper bound of the confidence intervals (excluded if ci.level = NULL)

See Also

confint2.default

Examples


est <- colMeans(attitude)
se <- apply(X = str2str::d2m(attitude), MARGIN = 2, FUN = function(vec)
   sqrt(var(vec) / length(vec)))
df <- nrow(attitude) - 1
nhst(est = est, se = se, df = df)
nhst(est = est, se = se) # default is df = Inf resulting in z-values
nhst(est = est, se = se, df = df, ci.level = NULL) # no "lwr" or "upr" columns
nhst(est = est, se = se, df = df, ci.level = 0.99)


[Package quest version 0.2.0 Index]