Calculate fire intervals from a composite

intervals(comp, densfun = "weibull")

Arguments

comp

A composite instance, usually output from composite(). Should contain only one series.

densfun

String giving desired distribution to fit. Either "weibull" or "lognormal". Default is "weibull".

Value

An intervals object. intervals have components:

  • "intervals" an integer vector giving the actual fire intervals.

  • "fitdistr" a fitdistr object from MASS::fitdistr() representing the density function fit.

  • "densfun" a string giving the name of the density function used.

  • "kstest" an htest object from stats::ks.test() giving the result of a one-sample Kolmogorov-Smirnov test.

  • "shapirotest" an htest object from stats::shapiro.test() giving the result of a Shapiro-Wilk normality test.

  • "comp_name" a string giving the name of the interval's input composite.

  • "event_range" an integer vector giving the year range (min, max) of events used to create this intervals.

See also

Examples

data(pgm)
interv <- intervals(composite(pgm))
#> Warning: ties should not be present for the Kolmogorov-Smirnov test
print(interv)
#> 	Interval Analysis
#> 	=================
#> 
#> Composite name: COMP
#> Events range: 1636 to 1871
#> 
#> 	Total intervals: 20
#> 	Mean interval: 11.8
#> 	Median interval: 10
#> 	Weibull median: 10.6
#> 	Standard deviation: 7.7
#> 	Minimum interval: 2
#> 	Maximum interval: 30
#> 
#> 
#> Theoretical distribution
#> ------------------------
#> 
#> Fit distribution: weibull
#> 
#>      shape        scale   
#>    1.6565206   13.2125358 
#>  ( 0.2797517) ( 1.8871133)
#> 
#> 
#> Percentiles
#> -----------
#> 
#> lower (12.5%): 3.9 | weibull median (50.0%): 10.6 | upper (87.5%): 20.6
#> 
#> Asymptotic one-sample Kolmogorov-Smirnov test
#> ---------------------------------------------
#> 
#> D^- = 0.12776, p = 0.89978
#> Null hypothesis: The intervals were sampled from the theoretical
#>     distribution.
#> Alt. hypothesis: The intervals were not sampled from the theoretical
#>     distribution.
#> 
#> 

mean(interv) # Mean interval
#> [1] 11.75

# Now fit log-normal distribution instead of Weibull.
intervals(composite(pgm), densfun = "lognormal")
#> Warning: ties should not be present for the Kolmogorov-Smirnov test
#> 	Interval Analysis
#> 	=================
#> 
#> Composite name: COMP
#> Events range: 1636 to 1871
#> 
#> 	Total intervals: 20
#> 	Mean interval: 11.8
#> 	Median interval: 10
#> 	Weibull median: 10.6
#> 	Standard deviation: 7.7
#> 	Minimum interval: 2
#> 	Maximum interval: 30
#> 
#> 
#> Theoretical distribution
#> ------------------------
#> 
#> Fit distribution: lognormal
#> 
#>     meanlog      sdlog  
#>   2.2538697   0.6779964 
#>  (0.1516046) (0.1072006)
#> 
#> 
#> Percentiles
#> -----------
#> 
#> lower (12.5%): 4.4 | lognormal median (50.0%): 9.5 | upper (87.5%): 20.8
#> 
#> Asymptotic one-sample Kolmogorov-Smirnov test
#> ---------------------------------------------
#> 
#> D^- = 0.09849, p = 0.99016
#> Null hypothesis: The intervals were sampled from the theoretical
#>     distribution.
#> Alt. hypothesis: The intervals were not sampled from the theoretical
#>     distribution.
#> 
#> 
if (FALSE) {
# Boxplot of fire interval distribution.
boxplot(intervals(composite(pgm))$intervals)
}