Learn R Programming

defm (version 0.2.1.0)

get_counters: Extract the counters from a DEFM model

Description

Counters are functions that are defined in terms of the change statistics. The counters also contain a hasher that is used internally to check whether an array's support is cached or not (see details).

Usage

get_counters(model)

# S3 method for DEFM_counters [(counters, i)

set_counter_info(counter, new_name = "", new_desc = "")

# S3 method for DEFM_counters length(x)

# S3 method for DEFM_counters as.list(x, ...)

# S3 method for DEFM_counter as.list(x, ...)

set_counters_names(x, ...)

# S3 method for DEFM set_counters_names(x, ...)

# S3 method for DEFM_counters set_counters_names(x, ...)

Value

  • The function get_counters returns an external pointer to an object of class DEFM_counters.

  • The method [.DEFM_counters returns an individual counter of class DEFM_counter.

  • set_counter_info() invisibly returns the modified counter.

  • The length method for DEFM_counters returns the number of counters in the vector. This should match the return from nterms_defm().

  • The as.list methods return a list with the name and description of the counters.

  • The function set_counters_names() returns the counters invisibly.

Arguments

model

A DEFM model object.

counters

An object of class DEFM_counters.

i

Integer from 0 to nterms - 1. Counter to get.

counter

An object of class DEFM_counter.

new_name, new_desc

Strings with the new name and new description, respectively. If empty, no side effect.

x

Either a DEFM_counters or a DEFM_counter object.

...

Further arguments passed to the method (not used).

Details

If the hash of an array--which are built using each counters' individual hashing functions--matches an existing array, then, the DEFM models reduce computational burden by recycling computations of the normalizing constant. For example, if a model only includes terms (counters) that do not feature individual-level characteristics like gender or age, then most likely all arrays in that model will use the same normalizing constant.

The function set_counter_info() can be used to modify a counter name and description. This is especially useful when a name is particularly long.