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

Details

Objects of S3 class "distChooseCensored" are lists that contain information about the candidate distributions, the estimated distribution parameters for each candidate distribution, and the test statistics and p-values associated with each candidate distribution.

Methods

Generic functions that have methods for objects of class "distChooseCensored" include:
print.

Value

Required Components
The following components must be included in a legitimate list of class "distChooseCensored".

choices

a character vector containing the full names of the candidate distributions. (see Distribution.df).

method

a character string denoting which method was used.

decision

a character vector containing the full name of the chosen distribution.

alpha

a numeric scalar between 0 and 1 specifying the Type I error associated with each goodness-of-fit test.

distribution.parameters

a numeric vector containing the estimated parameters associated with the chosen distribution.

estimation.method

a character string indicating the method used to compute the estimated parameters associated with the chosen distribution. The value of this component will depend on the available estimation methods (see Distribution.df).

sample.size

a numeric scalar containing the number of non-missing observations in the sample used for the goodness-of-fit tests.

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.

test.results

a list with the same number of components as the number of elements in the component choices. The names of the list are the distribution abbreviations of the candidate distributions. (See the help file for Distribution.df for a list of distributions and their abbreviations.) Each component is an object of class gofCensored containing the results of the goodness-of-fit test for that particular hypothesized distribution.

data.name

character string indicating the name of the data object used for the goodness-of-fit tests.

censoring.name

character string indicating the name of the data object used to identify which values are censored.


Optional Components
The following components are included in the result of calling distChooseCensored when the argument keep.data=TRUE:

data

numeric vector containing the data actually used for the goodness-of-fit tests (i.e., the original data without any missing or infinite values).

censored

logical vector containing the censoring status for the data actually used for the goodness-of-fit tests (i.e., the original data without any missing or infinite values).


The following component is included in the result of calling distChooseCensored when missing (NA), undefined (NaN) and/or infinite (Inf, -Inf) values are present:

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 choosing a distribution.

Note

Since objects of class "distChooseCensored" are lists, you may extract their components with the $ and [[ operators.

Author

Steven P. Millard (EnvStats@ProbStatInfo.com)

Examples

  # Create an object of class "distChooseCensored", then print it out. 
  # (Note: the call to set.seed simply allows you to reproduce 
  # this example.)

  set.seed(598)

  dat <- rgammaAlt(30, mean = 10, cv = 1)
  censored <- dat < 5
  dat[censored] <- 5

  distChooseCensored.obj <- distChooseCensored(dat, censored, 
    method = "sw", choices = c("norm", "gammaAlt", "lnormAlt"))

  mode(distChooseCensored.obj) 
#> [1] "list"
  #[1] "list" 

  class(distChooseCensored.obj) 
#> [1] "distChooseCensored"
  #[1] "distChooseCensored" 

  names(distChooseCensored.obj) 
#>  [1] "choices"                 "method"                 
#>  [3] "decision"                "alpha"                  
#>  [5] "distribution.parameters" "estimation.method"      
#>  [7] "sample.size"             "censoring.side"         
#>  [9] "censoring.levels"        "percent.censored"       
#> [11] "test.results"            "data"                   
#> [13] "censored"                "data.name"              
#> [15] "censoring.name"         
  # [1] "choices"                 "method"                 
  # [3] "decision"                "alpha"                  
  # [5] "distribution.parameters" "estimation.method"      
  # [7] "sample.size"             "censoring.side"         
  # [9] "censoring.levels"        "percent.censored"       
  #[11] "test.results"            "data"                   
  #[13] "censored"                "data.name"              
  #[15] "censoring.name" 

  distChooseCensored.obj 
#> $choices
#> [1] "Normal"    "Gamma"     "Lognormal"
#> 
#> $method
#> [1] "Shapiro-Wilk"
#> 
#> $decision
#> [1] "Gamma"
#> 
#> $alpha
#> [1] 0.05
#> 
#> $distribution.parameters
#>       mean         cv 
#> 12.4911448  0.7617343 
#> 
#> $estimation.method
#> [1] "MLE"
#> 
#> $sample.size
#> [1] 30
#> 
#> $censoring.side
#> [1] "left"
#> 
#> $censoring.levels
#> [1] 5
#> 
#> $percent.censored
#> [1] 23.33333
#> 
#> $test.results
#> $test.results$norm
#> 
#> Results of Goodness-of-Fit Test
#> Based on Type I Censored Data
#> -------------------------------
#> 
#> Test Method:                     Shapiro-Wilk GOF
#>                                  (Singly Censored Data)
#> 
#> Hypothesized Distribution:       Normal
#> 
#> Censoring Side:                  left
#> 
#> Censoring Level(s):              5 
#> 
#> Estimated Parameter(s):          mean = 11.44780
#>                                  sd   = 10.64297
#> 
#> Estimation Method:               MLE
#> 
#> Data:                            dat
#> 
#> Censoring Variable:              censored
#> 
#> Sample Size:                     30
#> 
#> Percent Censored:                23.33333%
#> 
#> Test Statistic:                  W = 0.9372741
#> 
#> Test Statistic Parameters:       N     = 30.0000000
#>                                  DELTA =  0.2333333
#> 
#> P-value:                         0.1704876
#> 
#> Alternative Hypothesis:          True cdf does not equal the
#>                                  Normal Distribution.
#> 
#> $test.results$gammaAlt
#> 
#> Results of Goodness-of-Fit Test
#> Based on Type I Censored Data
#> -------------------------------
#> 
#> Test Method:                     Shapiro-Wilk GOF
#>                                  (Singly Censored Data)
#>                                  Based on Chen & Balakrisnan (1995)
#> 
#> Hypothesized Distribution:       Gamma
#> 
#> Censoring Side:                  left
#> 
#> Censoring Level(s):              5 
#> 
#> Estimated Parameter(s):          mean = 12.4911448
#>                                  cv   =  0.7617343
#> 
#> Estimation Method:               MLE
#> 
#> Data:                            dat
#> 
#> Censoring Variable:              censored
#> 
#> Sample Size:                     30
#> 
#> Percent Censored:                23.33333%
#> 
#> Test Statistic:                  W = 0.9613711
#> 
#> Test Statistic Parameters:       N     = 30.0000000
#>                                  DELTA =  0.2333333
#> 
#> P-value:                         0.522329
#> 
#> Alternative Hypothesis:          True cdf does not equal the
#>                                  Gamma Distribution.
#> 
#> $test.results$lnormAlt
#> 
#> Results of Goodness-of-Fit Test
#> Based on Type I Censored Data
#> -------------------------------
#> 
#> Test Method:                     Shapiro-Wilk GOF
#>                                  (Singly Censored Data)
#> 
#> Hypothesized Distribution:       Lognormal
#> 
#> Censoring Side:                  left
#> 
#> Censoring Level(s):              5 
#> 
#> Estimated Parameter(s):          mean = 13.0382221
#>                                  cv   =  0.9129512
#> 
#> Estimation Method:               MLE
#> 
#> Data:                            dat
#> 
#> Censoring Variable:              censored
#> 
#> Sample Size:                     30
#> 
#> Percent Censored:                23.33333%
#> 
#> Test Statistic:                  W = 0.9292406
#> 
#> Test Statistic Parameters:       N     = 30.0000000
#>                                  DELTA =  0.2333333
#> 
#> P-value:                         0.114511
#> 
#> Alternative Hypothesis:          True cdf does not equal the
#>                                  Lognormal Distribution.
#> 
#> 
#> $data
#>  [1]  5.000000  5.520753 16.691071 17.028892  5.751383 13.956278 15.873064
#>  [8]  9.844409 30.291280  5.525360 10.624712 20.265714 42.872610  5.000000
#> [15] 11.792540  5.000000 16.003994 15.056334 14.602906 26.381597 19.110552
#> [22] 10.930492  5.717787  5.000000  5.000000 13.343269 17.850789  9.108638
#> [29]  5.000000  5.000000
#> 
#> $censored
#>  [1]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> [13] FALSE  TRUE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE
#> [25]  TRUE FALSE FALSE FALSE  TRUE  TRUE
#> 
#> $data.name
#> [1] "dat"
#> 
#> $censoring.name
#> [1] "censored"
#> 
#> attr(,"class")
#> [1] "distChooseCensored"
  
  #Results of Choosing Distribution
  #--------------------------------
  #
  #Candidate Distributions:         Normal
  #                                 Gamma
  #                                 Lognormal
  #
  #Choice Method:                   Shapiro-Wilk
  #
  #Type I Error per Test:           0.05
  #
  #Decision:                        Gamma
  #
  #Estimated Parameter(s):          mean = 12.4911448
  #                                 cv   =  0.7617343
  #
  #Estimation Method:               MLE
  #
  #Data:                            dat.censored
  #
  #Sample Size:                     30
  #
  #Censoring Side:                  left
  #
  #Censoring Variable:              censored
  #
  #Censoring Level(s):              5 
  #
  #Percent Censored:                23.33333%
  #
  #Test Results:
  #
  #  Normal                         
  #    Test Statistic:              W = 0.9372741
  #    P-value:                     0.1704876
  #
  #  Gamma                          
  #    Test Statistic:              W = 0.9613711
  #    P-value:                     0.522329
  #
  #  Lognormal                      
  #    Test Statistic:              W = 0.9292406
  #    P-value:                     0.114511

  #==========

  # Extract the choices
  #--------------------

  distChooseCensored.obj$choices
#> [1] "Normal"    "Gamma"     "Lognormal"
  #[1] "Normal"    "Gamma"     "Lognormal"

  #==========

  # Clean up
  #---------
  rm(dat, censored, distChooseCensored.obj)