The function either sets up a list of all parameters of a bamlss.frame, which can be used for setting up models, or extracts the estimated parameters of a bamlss object.

parameters(x, model = NULL, start = NULL,
  fill = c(0, 1e-04), list = FALSE,
  simple.list = FALSE, extract = FALSE,
  ...)

Arguments

x

A bamlss.frame or bamlss object.

model

The model name for which parameters should be initialized or extracted.

start

A named numeric vector which should be used when creating the parameter list. See also function link{set.starting.values}

fill

Numeric, when setting up a parameter list, the values the should be used for regression coefficients (first element of fill) and for smoothing variances (second element of fill).

list

Should the function return a list of all parameters?

simple.list

Should the names of parameter vectors be dropped?

extract

Should parameters of a bamlss.frame be extracted or initialized?

...

Currently not used.

Details

Parameters for BAMLSS are used for optimizer functions in function bamlss. The function is useful for initializing all parameters given a bamlss.frame (which is done internally in function bamlss), but also for extracting all estimated parameters of some optimizer.

The naming convention of the parameter list is used by a couple of functions in this package. For each parameter of the modeled distribution, e.g., gaussian_bamlss has parameters "mu" and "sigma", a list element is created. These elements the contain the list of all model term parameters. Parametric model terms are indicated with "p" and smooth model terms with "s". If the design matrix of a model term in the x list of a bamlss.frame does not contain any columns names, then the parameters are named with a leading "b", otherwise the column names of the design matrix are used. Smoothing variances parameter vectors are named with a leading "tau2".

The naming convention is useful when setting up new model fitting engines for bamlss and is used, e.g., by bfit and GMCMC, which are based on parameter state list objects as provided by function bamlss.engine.setup.

Value

A named list of all parameters of a bamlss.frame or bamlss

object.

Examples

## Create a "bamlss.frame"
set.seed(123)
d <- GAMart()
bf <- bamlss.frame(num ~ s(x1) + te(lon,lat), data = d)

## Create list of all parameters from "bamlss.frame".
p <- parameters(bf, list = TRUE)
str(p)
#> List of 2
#>  $ mu   :List of 2
#>   ..$ p: Named num 0
#>   .. ..- attr(*, "names")= chr "(Intercept)"
#>   ..$ s:List of 2
#>   .. ..$ s(x1)      : Named num [1:10] 0e+00 0e+00 0e+00 0e+00 0e+00 0e+00 0e+00 0e+00 0e+00 1e-04
#>   .. .. ..- attr(*, "names")= chr [1:10] "b1" "b2" "b3" "b4" ...
#>   .. ..$ te(lon,lat): Named num [1:26] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. .. ..- attr(*, "names")= chr [1:26] "b1" "b2" "b3" "b4" ...
#>  $ sigma:List of 1
#>   ..$ p: Named num 0
#>   .. ..- attr(*, "names")= chr "(Intercept)"

if (FALSE) ## Estimate model.
f <- list(num ~ s(x1) + te(lon,lat), sigma ~ s(x1))
b <- bamlss(f, data = d, sampler = FALSE)
#> Error in eval(bf, envir = parent.frame()): object 'f' not found

## Extract estimated parameters.
parameters(b)
#> Error in eval(expr, envir, enclos): object 'b' not found
parameters(b, list = TRUE)
#> Error in eval(expr, envir, enclos): object 'b' not found