TFixed: Specify a model based on a Student's t distribution with...

View source: R/SpecModel-generators.R

TFixedR Documentation

Specify a model based on a Student's t distribution with known location, scale, and degrees of freedom.

Description

Specify a model of the form

y_i = t(location[i], scale[i], df)

or

y_i = t(exposure[i] * location[i], scale[i], df)

.

Usage

TFixed(location, scale, df = 7, useExpose = TRUE)

Arguments

location

An object of class Values specifying the center of the distribution.

scale

Parameter governing dispersion. Can be an object of class Values, or a single number, a single number, in which case it is applied to all elements of location.

df

A positive number. Defaults to 7.

useExpose

Whether the model includes an exposure term. Defaults to TRUE.

Details

The model is useful as a data model where a few cells have much larger errors than the rest. Smaller values for df lead to thicker tails (ie larger probabilities of extreme values.) Subscript i denotes a cell within a classification defined by variables such as age, sex, and time. For instance cell i might be 30-34 year old females in 2020.

Value

An object of class SpecLikelihoodTFixed.

See Also

TFixed is typically used as part of a call to function Model. Similar data models that do not allow for the possibility of occasional large errors can be specified using Normal (though setting df to a value greater than 30 in TFixed will have much the same effect.) Flexible normal models can be specified using Normal.

Examples

location <- Values(array(c(0.95, 0.96, 0.95, 0.94),
                     dim = c(2, 2),
                     dimnames = list(age = c("0-39", "40+"),
                                     sex = c("Female", "Male"))))
scale <- Values(array(c(0.05, 0.08, 0.05, 0.04),
                   dim = c(2, 2),
                   dimnames = list(age = c("0-39", "40+"),
                                   sex = c("Female", "Male"))))
TFixed(location = location, scale = scale)
TFixed(location = location, scale = 0.1, df = 1)
TFixed(location = location, scale = 0.1, useExpose = FALSE)

## indistinguishable from normal distribution:
TFixed(location = location, scale = scale, df = 30)

## Cauchy distribution (very heavy tails):
TFixed(location = location, scale = scale, df = 1)

StatisticsNZ/demest documentation built on Nov. 2, 2023, 7:56 p.m.