This function obtains the summary table for objects of class marZIBPLaksh.
Returns the summary table.
# Example 1 ---------------------------------------------------------------
l1 <- 3
l2 <- 4
alpha <- -0.90
psi <- 0.2
set.seed(12345678)
data1 <- rZIBP_Laksh(n=100, l1=l1, l2=l2, alpha=alpha, psi=psi)
data1 <- as.data.frame(data1)
# To fit the model
mod1 <- NULL
mod1 <- marZIBP_Laksh(mu1.fo=X1~1,
mu2.fo=X2~1,
psi.fo=~1,
data=data1)
#> N = 4, M = 5 machine precision = 2.22045e-16
#> At X0, 0 variables are exactly at the bounds
#> At iterate 0 f= 484.52 |proj g|= 153.42
#> At iterate 10 f = 381.9 |proj g|= 0.031223
#> At iterate 20 f = 381.89 |proj g|= 0.09098
#>
#> iterations 23
#> function evaluations 30
#> segments explored during Cauchy searches 24
#> BFGS updates skipped 0
#> active bounds at final generalized Cauchy point 0
#> norm of the final projected gradient 0.00028121
#> final function value 381.891
#>
#> F = 381.891
#> final value 381.890661
#> converged
# To obtain the usual summary table
summary(mod1)
#> ---------------------------------------------------------------
#> Fixed effects for log(mu1)
#> ---------------------------------------------------------------
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 0.959844 0.075765 12.669 < 2.2e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> ---------------------------------------------------------------
#> Fixed effects for log(mu2)
#> ---------------------------------------------------------------
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 1.169665 0.070763 16.529 < 2.2e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> ---------------------------------------------------------------
#> Fixed effects for logit(psi)
#> ---------------------------------------------------------------
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -1.66049 0.27439 -6.0515 1.435e-09 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> ---------------------------------------------------------------
#> Estimation for alpha
#> ---------------------------------------------------------------
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -0.79917 5.13821 -0.1555 0.8764
#> ---------------------------------------------------------------
# To explore the estimations of l1, l2, mu and p
# To obtain E(Y1)=v1 and E(Y2)=v2
mod1$fitted.mu1[1]
#> [1] 2.611288
mod1$fitted.mu2[1]
#> [1] 3.220912
# To compare sample means with v1 and v2
colMeans(data1)
#> X1 X2
#> 2.61 3.22
# To obtain alpha and psi
mod1$fitted.alpha
#> [1] -0.7991705
mod1$fitted.psi[1]
#> [1] 0.1596964
# To obtain l1 and l2
mod1$fitted.l1[1]
#> [1] 3.107553
mod1$fitted.l2[1]
#> [1] 3.833034
# Example 2 ---------------------------------------------------------------
gen_data_ZIBP_Laksh <- function(n=100) {
# To generate the covariates
x1 <- runif(n=n)
x2 <- runif(n=n)
# To generate the means
mu1 <- exp(-2 + 3.5 * x1 + 2.7 * x2)
mu2 <- exp(-1 + 1.3 * x1 + 2.1 * x2)
# To generate the psi
logit_inv <- function(x) exp(x) / (1+exp(x))
psi <- logit_inv(-2.4 + 1.2 * x2)
alpha <- -1
# To obtain lambdas
l1 <- mu1 / (1-psi)
l2 <- mu2 / (1-psi)
# To generate Y1 and Y2
y <- NULL
for (i in 1:n)
y <- rbind(y, rZIBP_Laksh(n=1, l1=l1[i], l2=l2[i],
alpha=alpha, psi=psi[i]))
# To create the dataset
dataset <- data.frame(y1=y[,1], y2=y[,2],
x1=x1, x2=x2,
mu1=mu1, mu2=mu2,
alpha=alpha, psi=psi,
l1=l1, l2=l2)
return(dataset)
}
set.seed(123456)
data2 <- gen_data_ZIBP_Laksh(n=100)
head(data2, n=8)
#> y1 y2 x1 x2 mu1 mu2 alpha psi l1
#> 1 3 1 0.79778432 0.03855369 2.4506176 1.1253368 -1 0.08676931 2.6834595
#> 2 0 0 0.75356509 0.65944752 11.2232345 3.9136655 -1 0.16677432 13.4696215
#> 3 0 3 0.39125568 0.31146853 1.2341222 1.1767028 -1 0.11647553 1.3968172
#> 4 0 1 0.34155670 0.18956915 0.7462349 0.8539513 -1 0.10224576 0.8312240
#> 5 0 0 0.36129411 0.62607131 2.5984677 2.1911622 -1 0.16128277 3.0981452
#> 6 0 1 0.19834473 0.51671846 1.0934594 1.4091081 -1 0.14431081 1.2778698
#> 7 14 10 0.53485796 0.92794573 10.7774537 5.1758386 -1 0.21645173 13.7546774
#> 8 0 0 0.09652624 0.05837738 0.2221196 0.4714589 -1 0.08867293 0.2437321
#> l2
#> 1 1.2322591
#> 2 4.6970055
#> 3 1.3318282
#> 4 0.9512083
#> 5 2.6125161
#> 6 1.6467522
#> 7 6.6056410
#> 8 0.5173323
mod2 <- NULL
mod2 <- marZIBP_Laksh(mu1.fo=y1~x1+x2,
mu2.fo=y2~x1+x2,
psi.fo=~x2,
data=data2)
#> N = 9, M = 5 machine precision = 2.22045e-16
#> At X0, 0 variables are exactly at the bounds
#> At iterate 0 f= 1391.9 |proj g|= 537.42
#> At iterate 10 f = 362.78 |proj g|= 11.172
#> At iterate 20 f = 352.64 |proj g|= 2.597
#> At iterate 30 f = 352.58 |proj g|= 0.61651
#> At iterate 40 f = 352.4 |proj g|= 1.0726
#> At iterate 50 f = 352.39 |proj g|= 0.30517
#> At iterate 60 f = 352.38 |proj g|= 0.39111
#> At iterate 70 f = 352.37 |proj g|= 0.32202
#> At iterate 80 f = 352.37 |proj g|= 0.012024
#> At iterate 90 f = 352.37 |proj g|= 0.039797
#> At iterate 100 f = 352.37 |proj g|= 0.019207
#> At iterate 110 f = 352.37 |proj g|= 0.0104
#>
#> iterations 110
#> function evaluations 124
#> segments explored during Cauchy searches 111
#> BFGS updates skipped 0
#> active bounds at final generalized Cauchy point 0
#> norm of the final projected gradient 0.0104005
#> final function value 352.367
#>
#> F = 352.367
#> final value 352.367190
#> converged
summary(mod2)
#> ---------------------------------------------------------------
#> Fixed effects for log(mu1)
#> ---------------------------------------------------------------
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -1.84880 0.18034 -10.252 < 2.2e-16 ***
#> x1 3.27174 0.16686 19.608 < 2.2e-16 ***
#> x2 2.84826 0.19598 14.533 < 2.2e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> ---------------------------------------------------------------
#> Fixed effects for log(mu2)
#> ---------------------------------------------------------------
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -1.32182 0.22616 -5.8445 5.080e-09 ***
#> x1 1.40894 0.20975 6.7171 1.853e-11 ***
#> x2 2.58735 0.26971 9.5929 < 2.2e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> ---------------------------------------------------------------
#> Fixed effects for logit(psi)
#> ---------------------------------------------------------------
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -2.55624 1.01883 -2.5090 0.01211 *
#> x2 0.38412 1.42714 0.2692 0.78781
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> ---------------------------------------------------------------
#> Estimation for alpha
#> ---------------------------------------------------------------
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -0.9870 1.5567 -0.634 0.5261
#> ---------------------------------------------------------------
mod2$fitted.alpha
#> [1] -0.9870002