gofCensored.object.Rd
Objects of S3 class "gofCensored"
are returned by the EnvStats function
gofTestCensored
.
Objects of S3 class "gofCensored"
are lists that contain
information about the assumed distribution, the amount of censoring,
the estimated or user-supplied distribution parameters, and the test
statistic and p-value.
Generic functions that have methods for objects of class
"gofCensored"
include: print
, plot
.
Required Components
The following components must be included in a legitimate list of
class "gofCensored"
.
a character string indicating the name of the
assumed distribution (see Distribution.df
).
a character string containing the abbreviated name
of the distribution (see Distribution.df
).
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.
a scalar indicating the number of distribution
parameters estimated prior to performing the goodness-of-fit
test. The value of this component will be 0
if the parameters
were supplied by the user.
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 Distribution.df
). The value of this component
will be NULL
if the parameters were supplied by the user.
a numeric scalar with a names attribute containing the name and value of the goodness-of-fit statistic.
a numeric scalar containing the number of non-missing observations in the sample used for the goodness-of-fit test.
character string indicating whether the data are left- or right-censored.
numeric scalar or vector indicating the censoring level(s).
numeric scalar indicating the percent of non-missing observations that are censored.
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 statistic
component.
(except when test="chisq"
or test="ks"
)
numeric scalar containing the z-value associated with the
goodness-of-fit statistic.
numeric scalar containing the p-value associated with the goodness-of-fit statistic.
character string indicating the alternative hypothesis.
character string indicating the name of the
goodness-of-fit test (e.g., "Shapiro-Wilk GOF"
).
character string indicating the name of the data object used for the goodness-of-fit test.
logical vector indicating which observations are censored.
character string indicating the name of the object used to indicate the censoring.
Optional Components
The following components are included when the argument keep.data
is
set to TRUE
in the call to the function producing the
object of class "gofCensored"
.
numeric vector containing the data actually used for the goodness-of-fit test (i.e., the original data without any missing or infinite values).
logical vector indicating the censoring status of the data actually used for the goodness-of-fit test.
The following component is included when the data object
contains missing (NA
), undefined (NaN
) and/or infinite
(Inf
, -Inf
) values.
numeric scalar indicating the number of missing (NA
),
undefined (NaN
) and/or infinite (Inf
, -Inf
)
values that were removed from the data object prior to performing
the goodness-of-fit test.
Since objects of class "gofCensored"
are lists, you may extract
their components with the $
and [[
operators.
# Create an object of class "gofCensored", then print it out.
#------------------------------------------------------------
gofCensored.obj <- with(EPA.09.Ex.15.1.manganese.df,
gofTestCensored(Manganese.ppb, Censored, test = "sf"))
mode(gofCensored.obj)
#> [1] "list"
#[1] "list"
class(gofCensored.obj)
#> [1] "gofCensored"
#[1] "gofCensored"
names(gofCensored.obj)
#> [1] "distribution" "dist.abb"
#> [3] "distribution.parameters" "n.param.est"
#> [5] "estimation.method" "statistic"
#> [7] "sample.size" "censoring.side"
#> [9] "censoring.levels" "percent.censored"
#> [11] "parameters" "z.value"
#> [13] "p.value" "alternative"
#> [15] "method" "data"
#> [17] "data.name" "censored"
#> [19] "censoring.name"
# [1] "distribution" "dist.abb"
# [3] "distribution.parameters" "n.param.est"
# [5] "estimation.method" "statistic"
# [7] "sample.size" "censoring.side"
# [9] "censoring.levels" "percent.censored"
#[11] "parameters" "z.value"
#[13] "p.value" "alternative"
#[15] "method" "data"
#[17] "data.name" "censored"
#[19] "censoring.name" "bad.obs"
gofCensored.obj
#>
#> Results of Goodness-of-Fit Test
#> Based on Type I Censored Data
#> -------------------------------
#>
#> Test Method: Shapiro-Francia GOF
#> (Multiply Censored Data)
#>
#> Hypothesized Distribution: Normal
#>
#> Censoring Side: left
#>
#> Censoring Level(s): 2 5
#>
#> Estimated Parameter(s): mean = 15.23508
#> sd = 30.62812
#>
#> Estimation Method: MLE
#>
#> Data: Manganese.ppb
#>
#> Censoring Variable: Censored
#>
#> Sample Size: 25
#>
#> Percent Censored: 24%
#>
#> Test Statistic: W = 0.8368016
#>
#> Test Statistic Parameters: N = 25.00
#> DELTA = 0.24
#>
#> P-value: 0.004662658
#>
#> Alternative Hypothesis: True cdf does not equal the
#> Normal Distribution.
#Results of Goodness-of-Fit Test
#Based on Type I Censored Data
#-------------------------------
#
#Test Method: Shapiro-Francia GOF
# (Multiply Censored Data)
#
#Hypothesized Distribution: Normal
#
#Censoring Side: left
#
#Censoring Level(s): 2 5
#
#Estimated Parameter(s): mean = 15.23508
# sd = 30.62812
#
#Estimation Method: MLE
#
#Data: Manganese.ppb
#
#Censoring Variable: Censored
#
#Sample Size: 25
#
#Percent Censored: 24%
#
#Test Statistic: W = 0.8368016
#
#Test Statistic Parameters: N = 25.00
# DELTA = 0.24
#
#P-value: 0.004662658
#
#Alternative Hypothesis: True cdf does not equal the
# Normal Distribution.
#==========
# Extract the p-value
#--------------------
gofCensored.obj$p.value
#> [1] 0.004662658
#[1] 0.004662658
#==========
# Plot the results of the test
#-----------------------------
dev.new()
plot(gofCensored.obj)
#> Warning: Cannot construct histogram for multiply censored data when complete observations are between censoring levels
#==========
# Clean up
#---------
rm(gofCensored.obj)
graphics.off()