Compare the proportion of total variability explained by the fixed effects and each variance parameter.

# S3 method for class 'ssn_lm'
varcomp(object, ...)

# S3 method for class 'ssn_glm'
varcomp(object, ...)

Arguments

object

A fitted model object from ssn_lm() or ssn_glm().

...

Other arguments. Not used (needed for generic consistency).

Value

A tibble that partitions the total variability by the fixed effects and each variance parameter (see Details). For ssn_glm() models, only the variances on the link scale are considered (i.e., the variance function of the response is omitted).

Details

The total variability in the response is decomposed into a portion explained by the fixed effects and a portion explained by each variance parameter in the fitted covariance structure:

  • tailup_de: the tailup (downstream-moving) random error variance.

  • taildown_de: the taildown (upstream-moving) random error variance.

  • euclid_de: the Euclidean random error variance.

  • nugget: the nugget (spatially independent) random error variance.

  • random effects: if object was fit with a random argument, one additional variance parameter per named random effect term (e.g., a random intercept's grouping variable), representing the variance attributable to that grouping.

The proportion of variability explained by the fixed effects is the pseudo R-squared returned by pseudoR2(). The remaining 1 - pseudoR2 proportion is then split among tailup_de, taildown_de, euclid_de, nugget, and any random effect variances, in proportion to their share of the total variance (the sum of tailup_de, taildown_de, euclid_de, nugget, and all random effect variances).

Examples

# Copy the mf04p .ssn data to a local directory and read it into R
# When modeling with your .ssn object, you will load it using the relevant
# path to the .ssn data on your machine
copy_lsn_to_temp()
temp_path <- paste0(tempdir(), "/MiddleFork04.ssn")
mf04p <- ssn_import(temp_path, overwrite = TRUE)

ssn_mod <- ssn_lm(
  formula = Summer_mn ~ ELEV_DEM,
  ssn.object = mf04p,
  tailup_type = "exponential",
  additive = "afvArea"
)
varcomp(ssn_mod)
#> # A tibble: 5 × 2
#>   varcomp            proportion
#>   <chr>                   <dbl>
#> 1 Covariates (PR-sq)     0.585 
#> 2 tailup_de              0.399 
#> 3 taildown_de            0     
#> 4 euclid_de              0     
#> 5 nugget                 0.0155