get_coef_tbl: Extract coefficients from all parameters in GAMLSS model

Description Usage Arguments Details Value Examples

View source: R/get_coef_tbl.R

Description

Extracts coefficients from all parameters in GAMLSS model into a neat table.

Usage

1

Arguments

mod

object of class 'gamlss'. Model for which coefficients are to be obtained.

Details

Note that coefficients at this stage are automatically transformed using the inverse link function. If the link function is not one of identity, log or logit, then an error is thrown as the code does not yet invert using other functions.

Value

A tibble with column Variable specifying the variables and columns Mu coefficients, Sigma coefficients and so on for the remaining parameters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# data
data_mod <- data.frame(x = rnorm(20, 5) + rgamma(20, 0.01, 0.0001))
 data_mod[['y']] <- 3 * data_mod[['x']] + rnorm(20, sd = 5)

# model that only uses two parameters
mod_two_param <- gamlss::gamlss(formula = y ~ -1 +  x,
                                 family = "NO",
                                 data = data_mod,
                                 control = gamlss::gamlss.control(trace = FALSE))
# model that uses four parameters
mod_four_param <- gamlss::gamlss(formula = y ~ -1 +  x,
                                 family = "BCPE",
                                 data = data_mod,
                                 control = gamlss::gamlss.control(trace = FALSE))
coef_tbl(mod_two_param) # columns only for mu and sigma
coef_tbl(mod_four_param) # columns for mu, sigma, nu and tau

MiguelRodo/gamlssutils documentation built on July 9, 2020, 12:48 a.m.