This is the abstract base class for parametric regression model
objects like NormalGLM.
Parametric regression models are built around the following key tasks:
A method fit()
to fit the model to given data, i.e. compute the MLE
for the model parameters
Methods f_yx()
, F_yx()
and mean_yx()
to evaluate the conditional
density, distribution and regression function
A method sample_yx()
to generate a random sample of response variables
following the model given a vector of covariates
Methods
Method set_params()
Set the value of the model parameters used as default for the
class functions.
Usage
ParamRegrModel$set_params(params)
Arguments
params
model parameters to use as default
Returns
The modified object (self
), allowing for method chaining.
Method get_params()
Returns the value of the model parameters used as default for
the class functions.
Usage
ParamRegrModel$get_params()
Returns
model parameters used as default
Method fit()
Calculates the maximum likelihood estimator for the model
parameters based on given data.
Usage
ParamRegrModel$fit(data, params_init = private$params, loglik = loglik_xy)
Arguments
data
list containing the data to fit the model to
params_init
initial value of the model parameters to use for the
optimization (defaults to the fitted parameter values)
loglik
function(data, model, params)
defaults to loglik_xy()
Returns
MLE of the model parameters for the given data, same shape as
params_init
Method f_yx()
Evaluates the conditional density function.
Usage
ParamRegrModel$f_yx(t, x, params = private$params)
Arguments
t
value(s) at which the conditional density shall be evaluated
x
vector of covariates
params
model parameters to use, defaults to the fitted parameter
values
Returns
value(s) of the conditional density function, same shape as t
Method F_yx()
Evaluates the conditional distribution function.
Usage
ParamRegrModel$F_yx(t, x, params = private$params)
Arguments
t
value(s) at which the conditional distribution shall be
evaluated
x
vector of covariates
params
model parameters to use, defaults to the fitted parameter
values
Returns
value(s) of the conditional distribution function, same shape as
t
Method F1_yx()
Evaluates the conditional quantile function.
Usage
ParamRegrModel$F1_yx(t, x, params = private$params)
Arguments
t
value(s) at which the conditional quantile function shall be
evaluated
x
vector of covariates
params
model parameters to use, defaults to the fitted parameter
values
Returns
value(s) of the conditional quantile function, same shape as
t
Method sample_yx()
Generates a new sample of response variables with the same
conditional distribution.
Usage
ParamRegrModel$sample_yx(x, params = private$params)
Arguments
x
vector of covariates
params
model parameters to use, defaults to the fitted parameter
values
Returns
vector of sampled response variables, same length as x
Method mean_yx()
Evaluates the regression function or in other terms the
expected value of Y given X=x.
Usage
ParamRegrModel$mean_yx(x, params = private$params)
Arguments
x
vector of covariates
params
model parameters to use, defaults to the fitted parameter
values
Returns
value of the regression function
Method clone()
The objects of this class are cloneable with this method.
Usage
ParamRegrModel$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.