Learn R Programming

EnvStats (version 2.1.0)

gofCensored.object: S3 Class "gofCensored"

Description

Objects of S3 class "gofCensored" are returned by the EnvStats function gofTestCensored.

Arguments

Value

  • Required Components The following components must be included in a legitimate list of class "gofCensored".
  • distributiona character string indicating the name of the assumed distribution (see Distribution.df).
  • dist.abba character string containing the abbreviated name of the distribution (see Distribution.df).
  • distribution.parametersa 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.esta 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.
  • estimation.methoda 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.
  • statistica numeric scalar with a names attribute containing the name and value of the goodness-of-fit statistic.
  • sample.sizea numeric scalar containing the number of non-missing observations in the sample used for the goodness-of-fit test.
  • censoring.sidecharacter string indicating whether the data are left- or right-censored.
  • censoring.levelsnumeric scalar or vector indicating the censoring level(s).
  • percent.censorednumeric scalar indicating the percent of non-missing observations that are censored.
  • parametersnumeric 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.
  • z.value(except when test="chisq" or test="ks") numeric scalar containing the z-value associated with the goodness-of-fit statistic.
  • p.valuenumeric scalar containing the p-value associated with the goodness-of-fit statistic.
  • alternativecharacter string indicating the alternative hypothesis.
  • methodcharacter string indicating the name of the goodness-of-fit test (e.g., "Shapiro-Wilk GOF").
  • datanumeric vector containing the data actually used for the goodness-of-fit test (i.e., the original data without any missing or infinite values).
  • data.namecharacter string indicating the name of the data object used for the goodness-of-fit test.
  • censoredlogical vector indicating which observations are censored.
  • censoring.namecharacter string indicating the name of the object used to indicate the censoring.
  • bad.obsnumeric 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.

Methods

Generic functions that have methods for objects of class "gofCensored" include: print, plot.

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.

See Also

gofTestCensored, print.gofCensored, plot.gofCensored, Censored Data, Goodness-of-Fit Tests, Distribution.df, gof.object.

Examples

Run this code
# 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" 

  class(gofCensored.obj) 
  #[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"          "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.

  #==========

  # Extract the p-value
  #--------------------

  gofCensored.obj$p.value
  #[1] 0.004662658

  #==========

  # Plot the results of the test
  #-----------------------------

  dev.new()
  plot(gofCensored.obj)

  #==========

  # Clean up
  #---------
  rm(gofCensored.obj)
  graphics.off()

Run the code above in your browser using DataLab