LN_MeanReg {BayesLN} R Documentation

Bayesian Estimate of the conditional Log-normal Mean

Description

This function produces a bayesian estimate of the conditional log-normal mean assuming a GIG prior for the variance and an improper prior for the regression coefficients of the linear regression in the log scale.

Usage

LN_MeanReg(
y,
X,
Xtilde,
method = "weak_inf",
y_transf = TRUE,
h = NULL,
CI = TRUE,
alpha_CI = 0.05,
type_CI = "two-sided",
nrep = 1e+05
)


Arguments

 y Vector of observations of the response variable. X Design matrix. Xtilde Matrix of covariate patterns for which an estimate is required. method String that indicates the prior setting to adopt. Choosing "weak_inf" a weakly informative prior setting is adopted, whereas selecting "optimal" the hyperparameters are aimed at minimizing the frequentist MSE. y_transf Logical. If TRUE, the y vector is already assumed as log-transformed. h Leverage. With the default option NULL, the average leverage is used. CI Logical. With the default choice TRUE, the posterior credibility interval is computed. alpha_CI Level of alpha that determines the credibility (1-alpha_CI) of the posterior interval. type_CI String that indicates the type of interval to compute: "two-sided" (default), "UCL" (i.e. Upper Credible Limit) for upper one-sided intervals or "LCL" (i.e. Lower Credible Limit) for lower one-sided intervals. nrep Number of simulations.

Details

In this function the same procedure as LN_Mean is implemented allowing for the inclusion of covariates. Bayesian point and interval estimates for the response variabile in the original scale are provided considering the model: log(y_i)=Xβ.

Value

The function returns a list including the prior and posterior parameters, the point estimate of the log-normal mean conditioned with respect to the covariate points included in Xtilde. It consists of the mean of the posterior distribution for the functional \exp\{\tilde{x}_i^Tβ+σ^2/2\} and the posterior variance.

Source

Fabrizi, E., & Trivisano, C. Bayesian Conditional Mean Estimation in Log-Normal Linear Regression Models with Finite Quadratic Expected Loss. Scandinavian Journal of Statistics, 43(4), 1064-1077. (2016).

Examples

library(BayesLN)
data("fatigue")

# Design matrices
Xtot <- cbind(1, log(fatigue$stress), log(fatigue$stress)^2)
X <- Xtot[-c(1,13,22),]
y <- fatigue\$cycle[-c(1,13,22)]
Xtilde <- Xtot[c(1,13,22),]
#Estimation
LN_MeanReg(y = y,
X = X, Xtilde = Xtilde,
method = "weak_inf", y_transf = FALSE)



[Package BayesLN version 0.2.2 Index]