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

Details

Objects of S3 class "gofGroup" are lists that contain information about the assumed distribution, the estimated or user-supplied distribution parameters, and the test statistic and p-value.

Methods

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

Value

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

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).

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 statistic component.

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.,
"Wilk-Shapiro GOF (Normal Scores)").

data.name

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

grouping.variable

character string indicating the name of the variable defining the groups.

bad.obs

numeric vector indicating the number of missing (NA), undefined (NaN) and/or infinite (Inf, -Inf) values that were removed from each group and the grouping variable prior to performing the goodness-of-fit test.

n.groups

numeric scalar containing the number of groups.

group.names

character vector containing the levels of the grouping variable, i.e., the names of each of the groups.

group.scores

numeric vector containing the individual statistics for each group.

Optional Component
The following component is included when gofGroupTest is called with a formula for the first argument and a data argument.

parent.of.data

character string indicating the name of the object supplied in the data argument.

Note

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

Author

Steven P. Millard (EnvStats@ProbStatInfo.com)

Examples

  # Create an object of class "gofGroup", then print it out. 

  # Example 10-4 of USEPA (2009, page 10-20) gives an example of 
  # simultaneously testing the assumption of normality for nickel 
  # concentrations (ppb) in groundwater collected at 4 monitoring 
  # wells over 5 months.  The data for this example are stored in 
  # EPA.09.Ex.10.1.nickel.df.

  gofGroup.obj <- gofGroupTest(Nickel.ppb ~ Well, 
    data = EPA.09.Ex.10.1.nickel.df)

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

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

  names(gofGroup.obj) 
#>  [1] "distribution"      "dist.abb"          "statistic"        
#>  [4] "sample.size"       "parameters"        "p.value"          
#>  [7] "alternative"       "method"            "data.name"        
#> [10] "grouping.variable" "parent.of.data"    "bad.obs"          
#> [13] "n.groups"          "group.names"       "group.scores"     
  # [1] "distribution"      "dist.abb"          "statistic"        
  # [4] "sample.size"       "parameters"        "p.value"          
  # [7] "alternative"       "method"            "data.name"        
  #[10] "grouping.variable" "parent.of.data"    "bad.obs"          
  #[13] "n.groups"          "group.names"       "group.scores"

  gofGroup.obj 
#> 
#> Results of Group Goodness-of-Fit Test
#> -------------------------------------
#> 
#> Test Method:                     Wilk-Shapiro GOF (Normal Scores)
#> 
#> Hypothesized Distribution:       Normal
#> 
#> Data:                            Nickel.ppb
#> 
#> Grouping Variable:               Well
#> 
#> Data Source:                     EPA.09.Ex.10.1.nickel.df
#> 
#> Number of Groups:                4
#> 
#> Sample Sizes:                    Well.1 = 5
#>                                  Well.2 = 5
#>                                  Well.3 = 5
#>                                  Well.4 = 5
#> 
#> Test Statistic:                  z (G) = -3.658696
#> 
#> P-values for
#> Individual Tests:                Well.1 = 0.03510747
#>                                  Well.2 = 0.02385344
#>                                  Well.3 = 0.01120775
#>                                  Well.4 = 0.10681461
#> 
#> P-value for
#> Group Test:                      0.0001267509
#> 
#> Alternative Hypothesis:          At least one group
#>                                  does not come from a
#>                                  Normal Distribution.
  #Results of Group Goodness-of-Fit Test
  #-------------------------------------
  #
  #Test Method:                     Wilk-Shapiro GOF (Normal Scores)
  #
  #Hypothesized Distribution:       Normal
  #
  #Data:                            Nickel.ppb
  #
  #Grouping Variable:               Well
  #
  #Data Source:                     EPA.09.Ex.10.1.nickel.df
  #
  #Number of Groups:                4
  #
  #Sample Sizes:                    Well.1 = 5
  #                                 Well.2 = 5
  #                                 Well.3 = 5
  #                                 Well.4 = 5
  #
  #Test Statistic:                  z (G) = -3.658696
  #
  #P-values for
  #Individual Tests:                Well.1 = 0.03510747
  #                                 Well.2 = 0.02385344
  #                                 Well.3 = 0.01120775
  #                                 Well.4 = 0.10681461
  #
  #P-value for
  #Group Test:                      0.0001267509
  #
  #Alternative Hypothesis:          At least one group
  #                                 does not come from a
  #                                 Normal Distribution.  

  #==========

  # Extract the p-values
  #---------------------

  gofGroup.obj$p.value
#>       Well.1       Well.2       Well.3       Well.4        z (G) 
#> 0.0351074733 0.0238534406 0.0112077511 0.1068146088 0.0001267509 
  #      Well.1       Well.2       Well.3       Well.4        z (G) 
  #0.0351074733 0.0238534406 0.0112077511 0.1068146088 0.0001267509 

  #==========

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

  dev.new()
  plot(gofGroup.obj)

  #==========

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