BGR: Bivariate Gamma Regression

Description Usage Arguments Value Examples

View source: R/BGR.R

Description

Bivariate gamma regression models for three model types: EE, EI, IE. Models are estimated by EM algorithm.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
BGR(modelName = c("EE", "EI", "IE"), y, data, f1, f2, f3, f4,
  maxit = 300, tol = 1e-05, verbose = FALSE)

BGR_EE(y, data, f1, f2, f3, f4, maxit = 300, tol = 1e-05,
  verbose = FALSE)

BGR_EI(y, data, f1, f2, f3, maxit = 300, tol = 1e-05,
  verbose = FALSE)

BGR_IE(y, data, f4, maxit = 300, tol = 1e-05, verbose = FALSE)

Arguments

modelName

A character string indicating which model to be fitted. Need to be one of "EE", "EI", "IE".

y

A vector of character strings indicating which variables in the data are treated as response or dependent variables.

data

A matrix or data frame of observations. Categorical variables are allowed as covariates.

f1

A regression formula for the α_1 parameter in the bivariate gamma distribution. Note that, depending on the model type, might not be necessary to provide it.

f2

A regression formula for the α_2 parameter in the bivariate gamma distribution. Note that, depending on the model type, might not be necessary to provide it.

f3

A regression formula for the α_3 parameter in the bivariate gamma distribution. Note that, depending on the model type, might not be necessary to provide it.

f4

A regression formula for the β parameter in the bivariate gamma distribution. Note that, depending on the model type, might not be necessary to provide it.

maxit

A parameter that controls the number of maximum iteration in the EM algorithm. The default is 100.

tol

A parameter that controls the convergence tolerance in the EM algorithm. The default is 1e-5.

verbose

A logical controlling whether estimations in each EM iteration are shown in the fitting process. The default is TRUE.

Value

An object of class BGR providing the estimation results. The details of the output components are:

call

The matched call.

coefficients

The estimated coefficients.

alpha1

The estimated alpha1 values.

alpha2

The estimated alpha2 values.

alpha3

The estimated alpha3 values.

beta

The estimated beta values.

fitted.values

The fitted values of the regression.

loglike

The final estimated maximum log-likelihood value.

ll

The sequence of log-likelihood values in the EM algorithm fitting process.

df

Number of estimated parameters.

AIC

AIC values.

BIC

BIC values.

iter

Total iteration numbers.

formula

The formulas used in the regression.

y

The input response data.

n

The number of observations in the data.

Model.Matrix

The used model matrix for each regression formula.

trace

All estimated coefficients and alpha, beta values in the EM algorithm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
mod1 <- BGR(modelName = "EE",
            y = c("y1","y2"), data = fullsim,
            f1 = ~ w1 + w2,
            f2 = ~ w2 + w3,
            f3 = ~ w1 + w2 + w3,
            f4 = ~ w1 + w2 + w3,
            verbose= FALSE)
mod1

mod2 <- BGR(modelName = "EI",
            y = c("y1","y2"), data = fullsim,
            f1     = ~ w1 + w2,
            f2     = ~ w2 + w3,
            f3     = ~ w1 + w2 + w3,
            verbose= FALSE)
mod2
mod3 <- BGR(modelName = "IE",
            y = c("y1","y2"), data = fullsim,
            f4     = ~ w1 + w2 + w3,
            verbose= FALSE)
mod3

senhu/mvClaim documentation built on Jan. 29, 2022, 3:18 p.m.