LocationScaleRegression: R6 class for location-scale regression models

Description Public fields Methods Examples

Description

This model class assumes a normally distributed response variable with one linear predictor for the location (i.e. the mean) and one for the scale (i.e. the standard deviation). The linear predictors for the location and the scale are called and respectively. The scale uses a log link.

Public fields

beta

A numeric vector with the beta parameters.

gamma

A numeric vector with the gamma parameters.

Methods

Public methods


Method new()

Usage
LocationScaleRegression$new(
  location,
  scale = ~1,
  data = environment(location),
  ...
)
Arguments
location

A two-sided formula with the response variable on the LHS and the predictor for the location (i.e. the mean) on the RHS.

scale

A one-sided formula with the predictor for the scale (i.e. the standard deviation) on the RHS.

data

A data frame (or list or environment) in which to evaluate the location and scale formulas.

...

Passed on to stats::model.matrix().

Details

Create a new LocationScaleRegression object.

Returns

A LocationScaleRegression object.

Examples
y <- rnorm(30)
LocationScaleRegression$new(y ~ 1)


Method loglik()

Usage
LocationScaleRegression$loglik()
Details

Returns the log-likelihood of a LocationScaleRegression object at the current parameter values.

Returns

A single number.

Examples
y <- rnorm(30)
model <- LocationScaleRegression$new(y ~ 1)
model$loglik()


Method grad_beta()

Usage
LocationScaleRegression$grad_beta()
Details

Returns the gradient of the log-likelihood of a LocationScaleRegression object with respect to β at the current parameter values.

Returns

A numeric vector.

Examples
y <- rnorm(30)
model <- LocationScaleRegression$new(y ~ 1)
model$grad_beta()

Method grad_gamma()

Usage
LocationScaleRegression$grad_gamma()
Details

Returns the gradient of the log-likelihood of a LocationScaleRegression object with respect to γ at the current parameter values.

Returns

A numeric vector.

Examples
y <- rnorm(30)
model <- LocationScaleRegression$new(y ~ 1)
model$grad_gamma()

Method clone()

The objects of this class are cloneable with this method.

Usage
LocationScaleRegression$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## ------------------------------------------------
## Method `LocationScaleRegression$new`
## ------------------------------------------------

y <- rnorm(30)
LocationScaleRegression$new(y ~ 1)


## ------------------------------------------------
## Method `LocationScaleRegression$loglik`
## ------------------------------------------------

y <- rnorm(30)
model <- LocationScaleRegression$new(y ~ 1)
model$loglik()


## ------------------------------------------------
## Method `LocationScaleRegression$grad_beta`
## ------------------------------------------------

y <- rnorm(30)
model <- LocationScaleRegression$new(y ~ 1)
model$grad_beta()

## ------------------------------------------------
## Method `LocationScaleRegression$grad_gamma`
## ------------------------------------------------

y <- rnorm(30)
model <- LocationScaleRegression$new(y ~ 1)
model$grad_gamma()

hriebl/asp20model documentation built on April 2, 2020, 12:05 a.m.