1. Install Packages
Before running the MCPGIGR analysis, several R packages must be
installed and loaded to ensure that all functions required for
optimisation, distribution evaluation, and data handling are
available.
The code below shows the core packages used in this implementation.
# Core packages required for the MCPGIGR implementation
library("gmp")
library("Rmpfr")
library("MASS")
library("MixedPoisson")
library("gamlss")
library("Bessel")
library("maxLik")
library("COUNT")
library("readxl")
To keep the main scripts clean, the actual installation and loading
of these packages are handled in a separate script:
3. Initial Values
The initial values are obtained from Poisson regression and then used as
starting values for the MCPGIGR estimation.
# Script for generating initial parameter values
source("Initial Value.R")
3.1 Initial regression coefficients
beta_table %>%
round(6) %>%
kable(caption = "Initial Poisson-based regression coefficients (beta_0–beta_6) for Y1 and Y2.") %>%
kable_styling(full_width = FALSE,
bootstrap_options = c("striped", "hover", "condensed"))
Initial Poisson-based regression coefficients (beta_0–beta_6) for Y1 and
Y2.
|
|
beta_0
|
beta_1
|
beta_2
|
beta_3
|
beta_4
|
beta_5
|
beta_6
|
|
Y1
|
-7.290600
|
-0.003549
|
0.026758
|
0.003653
|
-0.010326
|
-0.028836
|
0.010342
|
|
Y2
|
-4.051717
|
0.002684
|
-0.014971
|
0.002583
|
-0.028747
|
0.007146
|
0.009814
|
3.2 Initial dispersion / mixing parameters
disp_table$Initial <- round(disp_table$Initial, 6)
disp_table %>%
kable(caption = "Initial values for dispersion / mixing parameters (tau and psi).") %>%
kable_styling(full_width = FALSE,
bootstrap_options = c("striped", "hover", "condensed"))
Initial values for dispersion / mixing parameters (tau and psi).
|
Parameter
|
Initial
|
|
tau
|
0.544815
|
|
psi
|
1.000000
|
4. Parameter Estimates (MCPGIGR)
Parameter estimation is carried out using maximum likelihood with the
BHHH algorithm.
# Scripts for MCPGIGR parameter estimation using MLE + BHHH
source("LnLikelihood.R")
source("Gradient.R")
source("Model Estimate.R")
source("Parameter Result.R")
4.1 Regression coefficients
param_table %>%
round(6) %>%
kable(caption = "MCPGIGR regression coefficient estimates for Y1 and Y2 (beta_0–beta_6).") %>%
kable_styling(full_width = FALSE,
bootstrap_options = c("striped", "hover", "condensed"))
MCPGIGR regression coefficient estimates for Y1 and Y2 (beta_0–beta_6).
|
|
beta_0
|
beta_1
|
beta_2
|
beta_3
|
beta_4
|
beta_5
|
beta_6
|
|
Y1
|
-4.921283
|
-0.003412
|
0.006403
|
0.000376
|
-0.016859
|
-0.012137
|
0.001298
|
|
Y2
|
-4.274388
|
0.004497
|
-0.016628
|
0.003926
|
-0.031171
|
0.010852
|
0.015793
|
4.2 Dispersion / mixing parameters
disp_table_hat$Estimate <- round(disp_table_hat$Estimate, 6)
disp_table_hat %>%
kable(caption = "Estimated dispersion / mixing parameters (psi and tau).") %>%
kable_styling(full_width = FALSE,
bootstrap_options = c("striped", "hover", "condensed"))
Estimated dispersion / mixing parameters (psi and tau).
|
Parameter
|
Estimate
|
|
psi
|
1.297504
|
|
tau
|
0.484547
|
5. Hypothesis Testing (Z-tests and Likelihood Ratio Test)
Hypothesis testing is based on the likelihood ratio test for the
global model comparison and Z-tests for individual parameters.
# Script for Z-tests and Likelihood Ratio Tests
source("Hypothesis Testing Result.R")
5.1 Simultaneous Test
Simultaneous.Test %>%
round(6) %>%
kable(caption = "Simultaneous test for MCPGIGR parameters.") %>%
kable_styling(full_width = FALSE,
bootstrap_options = c("striped", "hover", "condensed"))
Simultaneous test for MCPGIGR parameters.
|
Simultaneous.Test
|
Pr(>|Z|)
|
|
336.7596
|
0
|
5.1 Partial Test
Partial.test %>%
round(6) %>%
kable(caption = "Z-tests for individual MCPGIGR parameters (b01–b61, b02–b62, psi, tau).") %>%
kable_styling(full_width = FALSE,
bootstrap_options = c("striped", "hover", "condensed"))
Z-tests for individual MCPGIGR parameters (b01–b61, b02–b62, psi, tau).
|
|
Estimate
|
Std.Error
|
Z.Value
|
Pr(>|Z|)
|
|
b01
|
-4.921283
|
0.016518
|
-297.941987
|
0.000000
|
|
b11
|
-0.003412
|
0.002037
|
-1.675191
|
0.093897
|
|
b21
|
0.006404
|
0.003267
|
1.960184
|
0.049974
|
|
b31
|
0.000376
|
0.000938
|
0.401499
|
0.688052
|
|
b41
|
-0.016859
|
0.002558
|
-6.591714
|
0.000000
|
|
b51
|
-0.012137
|
0.003193
|
-3.800975
|
0.000144
|
|
b61
|
0.001298
|
0.002869
|
0.452431
|
0.650959
|
|
b02
|
-4.274388
|
0.033551
|
-127.398252
|
0.000000
|
|
b12
|
0.004497
|
0.001095
|
4.106302
|
0.000040
|
|
b22
|
-0.016628
|
0.002215
|
-7.505981
|
0.000000
|
|
b32
|
0.003927
|
0.000416
|
9.442844
|
0.000000
|
|
b42
|
-0.031171
|
0.001041
|
-29.943672
|
0.000000
|
|
b52
|
0.010852
|
0.000970
|
11.192611
|
0.000000
|
|
b62
|
0.015793
|
0.001458
|
10.828882
|
0.000000
|
|
psi
|
1.297504
|
0.008319
|
155.967692
|
0.000000
|
|
tau
|
0.484547
|
0.015378
|
31.508816
|
0.000000
|
6. Reproducibility Notes
## - All results above are generated using R version 4.3.3.
## - The full MCPGIGR pipeline is implemented through modular scripts (e.g., ` Install Packages.R`, `Input Data.R`, `Initial Value.R`, and the likelihood/gradient/estimation scripts) in the project root and `R/` folder.
## - To reproduce this report:
## 1. Clone the GitHub repository.
## 2. Open `MCPGIGR_Method.Rproj` in RStudio.
## 3. Run the modular scripts (or this R Markdown file) in the same working directory.
## 4. Knit this file to HTML.