Description Usage Arguments Examples
dhglmfit is used to fit a class of double hierarchical generalized linear models (DHGLMs) in which fixed and random effects can be specified in both the mean and the dispersion components. A variety of distributions and link functions for both the response variables and the random effects are allowed. Fixed and random effects can also be fitted in both the mean and the dispersion components. To call the fitting function dhglmfit, models for the mean and dispersion must be specified by DHGLMMODELING object preferably created by calling the DHGLMMODELING function.
1 2 3 4 5 |
RespDist |
The distribution of the response is set by the option RespDist. The user can set it to: "gaussian" (default), "binomial", "poisson", or "gamma". |
BinomialDen |
When RespDist="binomial", one should use the option BinomialDen to specify the denominator for the binomial distribution. This should be "NULL" (default) or a numeric vector of length equal to the length of DataMain. When specified as BinomialDen=NULL and RespDist="binomial", the denominator is 1. |
DataMain |
The option DataMain determines the data frame to be used (non-optional). |
MeanModel |
For the mean model, this option requries DGHLMMODELING object which should specified by the option Model="mean". |
DispersionModel |
For the overdispersion model, this option requries DGHLMMODELING object which should be specified by the option Model="dispersion". |
BetaFix, PhiFix, LamFix |
Three options that determine whether the mean parameters (beta), overdispersion parameters (phi) and random-effect variance (lambda) are to be estimated or maintaned constant. Specifying defaults such as BetaFix=NULL (or PhiFix =NULL or LamFix =NULL) implies that beta (or phi or lambda) is to be estimated. If not, beta (or phi or lambda) is fixed at a value specified by BetaFix (or PhiFix or LamFix). |
mord |
The option mord specifies the order of Laplace approximation to the marginal likelihood for fitting the mean parameters. The choice is either 0 or 1 (default). |
dord |
The option dord specifies the order of Laplace approximation to the adjusted profile likelihood for fitting the dispersion parameters. The choice is either 1 (default) or 2. |
REML |
logical - indicating whether REML method if it is TRUE (default) or ML method if FALSE are used. |
Maxiter |
Maxiter determines the maximum number of iterations for estimating all parameters. The default number is 200 iterations. |
convergence |
Setting this option determines the criterion for convergence, which is computed as the absolute difference between the values of all the estimated parameters in the previous and current iterations. The default criterion is 1e-06. |
EstCorr |
logical - indicating whether correlations are estimated if it is TRUE (default) or not estimated if FALSE are used. |
Dmethod |
Method of fitting dispersion model; "deviance" (default) or "Pearson". |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #### Analysis of crack-growth data ####
data(crack_growth)
## GLM ##
model_mu<-DHGLMMODELING(Model="mean", Link="log",
LinPred=y~crack0)
model_phi<-DHGLMMODELING(Model="dispersion")
res_glm<-dhglmfit(RespDist="gamma",DataMain=crack_growth,
MeanModel=model_mu,DispersionModel=model_phi,Maxiter=1)
## JGLM ##
model_mu<-DHGLMMODELING(Model="mean", Link="log",
LinPred=y~crack0)
model_phi<-DHGLMMODELING(Model="dispersion", Link="log",
LinPred=phi~cycle)
res_jglm<-dhglmfit(RespDist="gamma",DataMain=crack_growth,
MeanModel=model_mu,DispersionModel=model_phi,Maxiter=1)
## HGLM I ##
model_mu<-DHGLMMODELING(Model="mean", Link="log",
LinPred=y~crack0+(1|specimen),RandDist="inverse-gamma")
model_phi<-DHGLMMODELING(Model="dispersion")
res_hglm1<-dhglmfit(RespDist="gamma",DataMain=crack_growth,
MeanModel=model_mu,DispersionModel=model_phi,Maxiter=1)
## HGLM II ##
model_mu<-DHGLMMODELING(Model="mean", Link="log",
LinPred=y~crack0+(1|specimen),RandDist="inverse-gamma")
model_phi<-DHGLMMODELING(Model="dispersion", Link="log",
LinPred=phi~cycle)
res_hglm2<-dhglmfit(RespDist="gamma",DataMain=crack_growth,
MeanModel=model_mu,DispersionModel=model_phi,Maxiter=1)
## DHGLM I ##
model_mu<-DHGLMMODELING(Model="mean", Link="log",
LinPred=y~crack0+(1|specimen),RandDist="inverse-gamma")
model_phi<-DHGLMMODELING(Model="dispersion", Link="log",
LinPred=phi~cycle+(1|specimen),RandDist="gaussian")
res_dhglm1<-dhglmfit(RespDist="gamma",DataMain=crack_growth,
MeanModel=model_mu,DispersionModel=model_phi,Maxiter=1)
#### Analysis of epilepsy data ####
data(epilepsy)
model_mu<-DHGLMMODELING(Model="mean", Link="log",
LinPred=y~B+T+A+T*B+V+(1|patient),
RandDist=c("gaussian"))
model_phi<-DHGLMMODELING(Model="dispersion")
# res_hglm<-dhglmfit(RespDist="poisson",DataMain=epilepsy,
# MeanModel=model_mu,DispersionModel=model_phi,Maxiter=1)
|
Loading required package: Matrix
Loading required package: boot
Loading required package: MASS
Loading required package: car
Loading required package: carData
Attaching package: 'car'
The following object is masked from 'package:boot':
logit
Loading required package: sandwich
Distribution of Main Response :
"gamma"
[1] "Estimates from the model(mu)"
y ~ crack0
[1] "log"
Estimate Std. Error t-value p_val exp(LL) exp(UL)
(Intercept) -5.851 0.10585 -55.28 0.000e+00 0.002338 0.00354
crack0 2.569 0.09366 27.43 1.158e-165 10.867112 15.68809
[1] "Estimates from the model(phi)"
phi ~ 1
<environment: 0x70797c0>
[1] "log"
Estimate Std. Error t-value
(Intercept) -2.856 0.08509 -33.56
[1] "========== Likelihood Function Values and Condition AIC =========="
[,1]
-2ML (-2 h) : -1419.626
-2RL (-2 p_beta (h)) : -1415.858
cAIC : -1415.626
Scaled Deviance : 239.000
df : 239.000
Distribution of Main Response :
"gamma"
[1] "Estimates from the model(mu)"
y ~ crack0
[1] "log"
Estimate Std. Error t-value p_val exp(LL) exp(UL)
(Intercept) -5.851 0.10585 -55.28 0.000e+00 0.002338 0.00354
crack0 2.569 0.09366 27.43 1.158e-165 10.867112 15.68809
[1] "Estimates from the model(phi)"
phi ~ cycle
[1] "log"
Estimate Std. Error t-value
(Intercept) -2.317 0.1808 -12.81
cycle -9.426 2.5478 -3.70
[1] "========== Likelihood Function Values and Condition AIC =========="
[,1]
-2ML (-2 h) : -1432.157
-2RL (-2 p_beta (h)) : -1428.389
cAIC : -1428.157
Scaled Deviance : 239.000
df : 239.000
Distribution of Main Response :
"gamma"
[1] "Estimates from the model(mu)"
y ~ crack0 + (1 | specimen)
[1] "log"
Estimate Std. Error t-value
(Intercept) -5.688 0.4585 -12.405
crack0 2.397 0.3852 6.222
[1] "Estimates for logarithm of lambda=var(u_mu)"
[1] "inverse-gamma"
Estimate Std. Error t-value
specimen -3.332 0.3443 -9.677
[1] "Estimates from the model(phi)"
phi ~ 1
<environment: 0x81b8cd8>
[1] "log"
Estimate Std. Error t-value
(Intercept) -3.291 0.08782 -37.48
[1] "========== Likelihood Function Values and Condition AIC =========="
[,1]
-2ML (-2 p_v(mu) (h)) : -1542.6433
-2RL (-2 p_beta(mu),v(mu) (h)) : -1540.7796
cAIC : -1504.5792
Scaled Deviance : 222.1321
df : 222.1321
Distribution of Main Response :
"gamma"
[1] "Estimates from the model(mu)"
y ~ crack0 + (1 | specimen)
[1] "log"
Estimate Std. Error t-value
(Intercept) -5.688 0.4585 -12.405
crack0 2.397 0.3852 6.222
[1] "Estimates for logarithm of lambda=var(u_mu)"
[1] "inverse-gamma"
Estimate Std. Error t-value
specimen -3.332 0.3443 -9.677
[1] "Estimates from the model(phi)"
phi ~ cycle
[1] "log"
Estimate Std. Error t-value
(Intercept) -2.777 0.1866 -14.880
cycle -8.957 2.6291 -3.407
[1] "========== Likelihood Function Values and Condition AIC =========="
[,1]
-2ML (-2 p_v(mu) (h)) : -1554.0255
-2RL (-2 p_beta(mu),v(mu) (h)) : -1552.1618
cAIC : -1515.9615
Scaled Deviance : 222.1321
df : 222.1321
Distribution of Main Response :
"gamma"
[1] "Estimates from the model(mu)"
y ~ crack0 + (1 | specimen)
[1] "log"
Estimate Std. Error t-value
(Intercept) -5.688 0.4585 -12.405
crack0 2.397 0.3852 6.222
[1] "Estimates for logarithm of lambda=var(u_mu)"
[1] "inverse-gamma"
Estimate Std. Error t-value
specimen -3.332 0.3443 -9.677
[1] "Estimates from the model(phi)"
phi ~ cycle + (1 | specimen)
[1] "log"
Estimate Std. Error t-value
(Intercept) -2.879 0.1728 -16.657
cycle -9.052 2.2202 -4.077
[1] "Estimates for logarithm of var(u_phi)"
Estimate Std. Error t-value
specimen -2.101 0.803 -2.617
[1] "========== Likelihood Function Values and Condition AIC =========="
[,1]
-2ML (-2 p_v(mu),v(phi) (h)) : -1578.2292
-2RL (-2 p_beta(mu),v(mu),beta(phi),v(phi) (h)) : -1576.3655
cAIC : -1540.1652
Scaled Deviance : 222.1321
df : 222.1321
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.