Learn R Programming

lmvar (version 1.5.2)

lmvar_no_fit: Create an 'lmvar'-like object without a model fit

Description

Creates an 'lmvar'-like object without carrying out a model fit. This object is a 'lmvar' object from which all members have been left out that are the result of the fit. Such an object can be used in functions which typically use an 'lmvar' object as input but do not need the fit results. Since no fit is performed, lmvar_no_fit is convenient when the fit is time-consuming or, e.g., does not converge.

Usage

lmvar_no_fit(y, X_mu = NULL, X_sigma = NULL, intercept_mu = TRUE,
  intercept_sigma = TRUE, sigma_min = 0, slvr_options = list(method =
  "NR"), control = list(), ...)

Arguments

y

Vector of observations

X_mu

Model matrix for the expected values \(\mu\)

X_sigma

Model matrix for the logarithms of the standard deviations \(\sigma\)

intercept_mu

see the function lmvar

intercept_sigma

see the function lmvar.

sigma_min

see the function lmvar.

slvr_options

see the function lmvar

control

see the function lmvar.

...

Additional arguments, not used in the current implementation

Value

An object of class 'lmvar_no_fit', which is a list. The list-members are the same as for an object of call 'lmvar', but with members that are the result of the model fit left out.

Users are discouraged to access list-members directly. Instead, list-members are to be accessed with the various accessor and utility functions in the package. Exceptions are the following list members for which no accessor functions exist:

  • call the function call

  • y the vector of observations

  • X_mu the model matrix for \(\mu\). In general, it differs from the user-supplied X_mu because lmvar_no_fit adds an intercept-column (unless intercept_mu is FALSE) and makes the matrix full-rank.

  • X_sigma the model matrix for \(\log \sigma\). In general, it differs from the user-supplied X_sigma because lmvar_no_fit adds an intercept-column (unless intercept_sigma is FALSE) and makes the matrix full-rank.

  • intercept_mu boolean which tells whether or not an intercept column (Intercept) has been added to the model matrix \(X_\mu\)

  • intercept_sigma boolean which tells whether or not an intercept column (Intercept_s) has been added to the model matrix \(X_\sigma\)

  • sigma_min the value of the argument sigma_min in the call of lmvar_no_fit

  • slvr_options the value of the argument slvr_options in the call of lmvar_no_fit

  • control the value of the argument control in the call of lmvar_no_fit

Details

See lmvar for the requirements and a further explanation of all the arguments.

The class 'lmvar' is an extension of the class 'lmvar_no_fit'. This means that each object which is of class 'lmvar', is of class 'lmvar_no_fit' as well. Wherever an object of class 'lmvar_no_fit' is required, an object of class 'lmvar' can be used as well.

Accessor and utility functions for a 'lmvar_no_fit' object are: nobs.lmvar_no_fit, alias.lmvar_no_fit and dfree

The function lmvar_no_fit is especially useful in combination with fwbw.lmvar_no_fit. In case a model with many degrees of freedom does not converge with lmvar, one can create an 'lmvar_no_fit' object. This is used as input for fwbw with the argument fw = TRUE. The fwbw algorithm will try to select an optimal subset of all degrees of freedom, starting with the smallest subset possible.

Although lmvar_no_fit does not carry out a model fit, it will do the following:

  • add an intercept term to the model matrices (unless intercept_mu is FALSE and/or intercept_sigma is FALSE), and

  • make the model matrices full rank.

Examples

Run this code
# NOT RUN {
# As example we sue the dataset 'iris' from the library 'datasets'
library(datasets)

# Create the model matrix for both the expected values and the standard deviations
X = model.matrix( ~ Species - 1, data = iris)

# Take as response variabe the variable Sepal.length
y = iris$Sepal.Length

# Construct a 'lmvar_no_fit' object
no_fit = lmvar_no_fit( y, X, X)

# The following functions all work on such an object
nobs(no_fit)
dfree(no_fit)
alias(no_fit)

# You can also supply 'lmvar' arguments
no_fit = lmvar_no_fit( y, X[,-1], X[,-1], intercept_mu = FALSE, intercept_sigma = FALSE)
dfree(no_fit)

# Some (most) arguments have no effect except that they are stored in the 'lmvar_no_fit'
# object
no_fit = lmvar_no_fit( y, X, X, control = list( slvr_log = TRUE, remove_df_sigma = TRUE))
no_fit$control
# }

Run the code above in your browser using DataLab