Objects of S3 class "gofCensored" are returned by the EnvStats function
gofTestCensored.
Details
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.
Methods
Generic functions that have methods for objects of class
"gofCensored" include: print, plot.
Value
Required Components
The following components must be included in a legitimate list of
class "gofCensored".
- distribution
a character string indicating the name of the assumed distribution (see
Distribution.df).- dist.abb
a character string containing the abbreviated name of the distribution (see
Distribution.df).- 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
0if the parameters were supplied by the user.- 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
Distribution.df). The value of this component will beNULLif the parameters were supplied by the user.- 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.
- censoring.side
character string indicating whether the data are left- or right-censored.
- censoring.levels
numeric scalar or vector indicating the censoring level(s).
- percent.censored
numeric scalar indicating the percent of non-missing observations that are censored.
- 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
statisticcomponent.- z.value
(except when
test="chisq"ortest="ks") numeric scalar containing the z-value associated with the goodness-of-fit statistic.- 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.,
"Shapiro-Wilk GOF").- data.name
character string indicating the name of the data object used for the goodness-of-fit test.
- censored
logical vector indicating which observations are censored.
- censoring.name
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".
- 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).
- censored
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.
- bad.obs
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.
Note
Since objects of class "gofCensored" are lists, you may extract
their components with the $ and [[ operators.
Author
Steven P. Millard (EnvStats@ProbStatInfo.com)
Examples
# 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
#-----------------------------
if (interactive()) 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()