S3 Class "htest"
This class of objects is returned by functions that perform hypothesis tests
(e.g., the R function t.test
, the EnvStats function
kendallSeasonalTrendTest
, etc.).
Objects of class "htest"
are lists that contain information about the null
and alternative hypotheses, the estimated distribution parameters, the test statistic,
the p-value, and (optionally) confidence intervals for distribution parameters.
Objects of S3 class "htest"
are returned by any of the
EnvStats functions that perform hypothesis tests as listed
here: Hypothesis Tests.
(Note that functions that perform goodness-of-fit tests
return objects of class "gof"
or "gofTwoSample"
.)
Objects of class "htest"
generated by EnvStats functions may
contain additional components called
estimation.method
(method used to estimate the population parameter(s)),
sample.size
, and
bad.obs
(number of missing (NA
), undefined (NaN
), or infinite
(Inf
, -Inf
) values removed prior to performing the hypothesis test),
and interval
(a list with information about a confidence, prediction, or
tolerance interval).
Required Components
The following components must be included in a legitimate list of
class "htest"
.
null.value |
numeric vector containing the value(s) of the population parameter(s) specified by
the null hypothesis. This vector has a |
alternative |
character string indicating the alternative hypothesis (the value of the input
argument |
method |
character string giving the name of the test used. |
estimate |
numeric vector containing the value(s) of the estimated population parameter(s)
involved in the null hypothesis. This vector has a |
data.name |
character string containing the actual name(s) of the input data. |
statistic |
numeric scalar containing the value of the test statistic, with a
|
parameters |
numeric vector containing the parameter(s) associated with the null distribution of
the test statistic. This vector has a |
p.value |
numeric scalar containing the p-value for the test under the null hypothesis. |
Optional Components
The following component may optionally be included in an object of
of class "htest"
generated by R functions that test hypotheses:
conf.int |
numeric vector of length 2 containing lower and upper confidence limits for the
estimated population parameter. This vector has an attribute called
|
The following components may be included in objects of class "htest"
generated by EnvStats functions:
sample.size |
numeric scalar containing the number of non-missing observations in the sample used for the hypothesis test. |
estimation.method |
character string containing the method used to compute the estimated distribution
parameter(s). The value of this component will depend on the available estimation
methods (see |
bad.obs |
the number of missing ( |
interval |
a list containing information about a confidence, prediction, or tolerance interval. |
Generic functions that have methods for objects of class
"htest"
include: print
.
Since objects of class "htest"
are lists, you may extract
their components with the $
and [[
operators.
Steven P. Millard (EnvStats@ProbStatInfo.com)
# Create an object of class "htest", then print it out. #------------------------------------------------------ htest.obj <- chenTTest(EPA.02d.Ex.9.mg.per.L.vec, mu = 30) mode(htest.obj) #[1] "list" class(htest.obj) #[1] "htest" names(htest.obj) # [1] "statistic" "parameters" "p.value" "estimate" # [5] "null.value" "alternative" "method" "sample.size" # [9] "data.name" "bad.obs" "interval" htest.obj #Results of Hypothesis Test #-------------------------- # #Null Hypothesis: mean = 30 # #Alternative Hypothesis: True mean is greater than 30 # #Test Name: One-sample t-Test # Modified for # Positively-Skewed Distributions # (Chen, 1995) # #Estimated Parameter(s): mean = 34.566667 # sd = 27.330598 # skew = 2.365778 # #Data: EPA.02d.Ex.9.mg.per.L.vec # #Sample Size: 60 # #Test Statistic: t = 1.574075 # #Test Statistic Parameter: df = 59 # #P-values: z = 0.05773508 # t = 0.06040889 # Avg. of z and t = 0.05907199 # #Confidence Interval for: mean # #Confidence Interval Method: Based on z # #Confidence Interval Type: Lower # #Confidence Level: 95% # #Confidence Interval: LCL = 29.82 # UCL = Inf #========== # Extract the test statistic #--------------------------- htest.obj$statistic # t #1.574075 #========== # Clean up #--------- rm(htest.obj)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.