modavg.utility: Various Utility Functions

modavg.utilityR Documentation

Various Utility Functions

Description

reverse.parm and reverse.exclude reverse the order of variables in an interaction term.

formatCands creates new classes for lists containing candidate models.

formulaShort prints a succinct formula from an unmarkedFit object.

Usage

reverse.parm(parm)
reverse.exclude(exclude)
formatCands(cand.set)
formulaShort(mod, unmarked.type = NULL)

Arguments

parm

a parameter to be model-averaged, enclosed between quotes, as it appears in the output of some models.

exclude

a list of interaction or polynomial terms appearing in some models, as they would appear in the call to the model function (i.e., A*B, A:B). Models containing elements from the list will be excluded to obtain a model-averaged estimate.

cand.set

a list storing each of the models in the candidate model set.

mod

an object storing the result of an unmarkedFit.

unmarked.type

a character string specifying the type of parameter in an unmarkedFit for which a formula is requested. This argument uses the character string for each parameter group as defined by unmarked.

Details

These utility functions are used internally by aictab, modavg, and other related functions.

reverse.parm and reverse.exclude enable the user to specify differently interaction terms (e.g., A:B, B:A) across models for model averaging. These functions have been added to avoid problems when users are not consistent in the specification of interaction terms across models.

formatCands creates new classes for the list of candidate models based on the contents of the list. These new classes are used for method dispatch.

formulaShort is used by anovaOD.

Value

reverse.parm returns all possible combinations of an interaction term to identify models that include the parm of interest and find the corresponding estimate and standard error in the model object.

reverse.exclude returns a list of all possible combinations of exclude to identify models that should be excluded when computing a model-averaged estimate.

formatCands adds a new class to the list of candidate models based on the classes of the models.

formulaShort creates a character string for the formula related to a given parameter type from an unmarkedFit object.

Author(s)

Marc J. Mazerolle

See Also

aictab, anovaOD, modavg, modavgShrink, modavgPred

Examples

##a main effect
reverse.parm(parm = "Ageyoung") #does not return anything


##an interaction term as it might appear in the output
reverse.parm(parm = "Ageyoung:time") #returns the reverse


##exclude two interaction terms
reverse.exclude(exclude = list("Age*time", "A:B"))
##returns all combinations
reverse.exclude(exclude = list("Age:time", "A*B"))
##returns all combinations


##Mazerolle (2006) frog water loss example
data(dry.frog)

##setup a subset of models of Table 1
Cand.models <- list( )
Cand.models[[1]] <- lm(log_Mass_lost ~ Shade + Substrate +
                       cent_Initial_mass + Initial_mass2,
                       data = dry.frog)
Cand.models[[2]] <- lm(log_Mass_lost ~ Shade + Substrate +
                       cent_Initial_mass + Initial_mass2 +
                       Shade:Substrate, data = dry.frog)
Cand.models[[3]] <- lm(log_Mass_lost ~ cent_Initial_mass +
                       Initial_mass2, data = dry.frog)

formatCands(Cand.models)

## Not run: 
require(unmarked)
data(bullfrog)
bfrog <- unmarkedFrameOccu(y = bullfrog[, c("V1", "V2", "V3", "V4")],
                           siteCovs = bullfrog[, 1:2])
fm1 <- occu(~ 1 ~ Reed.presence, data = bfrog)
formulaShort(fm1, unmarked.type = "state")
formulaShort(fm1, unmarked.type = "det")

## End(Not run)

AICcmodavg documentation built on Nov. 17, 2023, 1:08 a.m.