View source: R/psymet_functions.R
| nhst | R Documentation |
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.
nhst(est, se, df = Inf, ci.level = 0.95, p.value = "two.sided")
est |
numeric vector of parameter estimates. |
se |
numeric vector of standard errors. Must be the same length as
|
df |
numeric vector of degrees of freedom. Must be length of 1 or have
same length as |
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. |
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:
parameter estimates
standard errors
t-values (z-values if df = Inf)
degrees of freedom
p-values
lower bound of the confidence intervals (excluded if ci.level = NULL)
upper bound of the confidence intervals (excluded if ci.level = NULL)
confint2.default
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.