S3 Class "gof"
Objects of S3 class "gof"
are returned by the EnvStats function
gofTest
when just the x
argument is supplied.
Objects of S3 class "gof"
are lists that contain
information about the assumed distribution, the estimated or
user-supplied distribution parameters, and the test statistic
and p-value.
Required Components
The following components must be included in a legitimate list of
class "gof"
.
distribution |
a character string indicating the name of the
assumed distribution (see |
dist.abb |
a character string containing the abbreviated name
of the distribution (see |
distribution.parameters |
a numeric vector with a names attribute containing the names and values of the estimated or user-supplied distribution parameters associated with the assumed distribution. |
n.param.est |
a scalar indicating the number of distribution
parameters estimated prior to performing the goodness-of-fit
test. The value of this component will be |
estimation.method |
a character string indicating the method
used to compute the estimated parameters. The value of this
component will depend on the available estimation methods
(see |
statistic |
a numeric scalar with a names attribute containing the name and value of the goodness-of-fit statistic. |
sample.size |
a numeric scalar containing the number of non-missing observations in the sample used for the goodness-of-fit test. |
parameters |
numeric vector with a names attribute containing
the name(s) and value(s) of the parameter(s) associated with the
test statistic given in the |
z.value |
(except when |
p.value |
numeric scalar containing the p-value associated with the goodness-of-fit statistic. |
alternative |
character string indicating the alternative hypothesis. |
method |
character string indicating the name of the
goodness-of-fit test (e.g., |
data |
numeric vector containing the data actually used for the goodness-of-fit test (i.e., the original data without any missing or infinite values). |
data.name |
character string indicating the name of the data object used for the goodness-of-fit test. |
bad.obs |
numeric scalar indicating the number of missing ( |
NOTE: when the function gofTest
is called with
both arguments x
and y
and test="ks"
, it
returns an object of class "gofTwoSample"
.
No specific parametric distribution is assumed, so the value of the component
distribution
is "Equal"
and the following components
are omitted: dist.abb
, distribution.parameters
,
n.param.est
, estimation.method
, and z.value
.
cut.points |
numeric vector containing the cutpoints used to define the cells. |
counts |
numeric vector containing the observed number of counts for each cell. |
expected |
numeric vector containing the expected number of counts for each cell. |
X2.components |
numeric vector containing the contribution of each cell to the chi-square statistic. |
Since objects of class "gof"
are lists, you may extract
their components with the $
and [[
operators.
Steven P. Millard (EnvStats@ProbStatInfo.com)
# Create an object of class "gof", then print it out. # (Note: the call to set.seed simply allows you to reproduce # this example.) set.seed(250) dat <- rnorm(20, mean = 3, sd = 2) gof.obj <- gofTest(dat) mode(gof.obj) #[1] "list" class(gof.obj) #[1] "gof" names(gof.obj) # [1] "distribution" "dist.abb" # [3] "distribution.parameters" "n.param.est" # [5] "estimation.method" "statistic" # [7] "sample.size" "parameters" # [9] "z.value" "p.value" #[11] "alternative" "method" #[13] "data" "data.name" #[15] "bad.obs" gof.obj #Results of Goodness-of-Fit Test #------------------------------- # #Test Method: Shapiro-Wilk GOF # #Hypothesized Distribution: Normal # #Estimated Parameter(s): mean = 2.861160 # sd = 1.180226 # #Estimation Method: mvue # #Data: dat # #Sample Size: 20 # #Test Statistic: W = 0.9640724 # #Test Statistic Parameter: n = 20 # #P-value: 0.6279872 # #Alternative Hypothesis: True cdf does not equal the # Normal Distribution. #========== # Extract the p-value #-------------------- gof.obj$p.value #[1] 0.6279872 #========== # Plot the results of the test #----------------------------- dev.new() plot(gof.obj) #========== # Clean up #--------- rm(dat, gof.obj) graphics.off()
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.