zoabetaR: Zero- and One-Inflated Beta Distribution Family Function

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/family.aunivariate.R

Description

Estimation of the shape parameters of the two-parameter beta distribution plus the probabilities of a 0 and/or a 1.

Usage

1
2
3
4
zoabetaR(lshape1 = "loglink", lshape2 = "loglink", lpobs0 = "logitlink",
   lpobs1 = "logitlink", ishape1 = NULL, ishape2 = NULL, trim = 0.05,
   type.fitted = c("mean", "pobs0", "pobs1", "beta.mean"),
   parallel.shape = FALSE, parallel.pobs = FALSE, zero = NULL)

Arguments

lshape1, lshape2, lpobs0, lpobs1

Details at CommonVGAMffArguments. See Links for more choices.

ishape1, ishape2

Details at CommonVGAMffArguments.

trim, zero

Same as betaR.

parallel.shape, parallel.pobs

See CommonVGAMffArguments for more information.

type.fitted

The choice "beta.mean" mean to return the mean of the beta distribution; the 0s and 1s are ignored. See CommonVGAMffArguments for more information.

Details

The standard 2-parameter beta distribution has a support on (0,1), however, many datasets have 0 and/or 1 values too. This family function handles 0s and 1s (at least one of them must be present) in the data set by modelling the probability of a 0 by a logistic regression (default link is the logit), and similarly for the probability of a 1. The remaining proportion, 1-pobs0-pobs1, of the data comes from a standard beta distribution. This family function therefore extends betaR. One has M=3 or M=4 per response. Multiple responses are allowed.

Value

Similar to betaR.

Author(s)

Thomas W. Yee and Xiangjie Xue.

See Also

Zoabeta, betaR, betaff, Beta, zipoisson.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
nn <- 1000; set.seed(1)
bdata <- data.frame(x2 = runif(nn))
bdata <- transform(bdata,
  pobs0 = logitlink(-2 + x2, inverse = TRUE),
  pobs1 = logitlink(-2 + x2, inverse = TRUE))
bdata <- transform(bdata,
  y1 = rzoabeta(nn, shape1 = exp(1 + x2), shape2 = exp(2 - x2),
                pobs0 = pobs0, pobs1 = pobs1))
summary(bdata)
fit1 <- vglm(y1 ~ x2, zoabetaR(parallel.pobs = TRUE),
             data = bdata, trace = TRUE)
coef(fit1, matrix = TRUE)
summary(fit1)

Example output

Loading required package: stats4
Loading required package: splines
       x2               pobs0            pobs1              y1        
 Min.   :0.001315   Min.   :0.1193   Min.   :0.1193   Min.   :0.0000  
 1st Qu.:0.258129   1st Qu.:0.1491   1st Qu.:0.1491   1st Qu.:0.1807  
 Median :0.483260   Median :0.1799   Median :0.1799   Median :0.4567  
 Mean   :0.499692   Mean   :0.1863   Mean   :0.1863   Mean   :0.4733  
 3rd Qu.:0.746932   3rd Qu.:0.2222   3rd Qu.:0.2222   3rd Qu.:0.7384  
 Max.   :0.999931   Max.   :0.2689   Max.   :0.2689   Max.   :1.0000  
VGLM    linear loop  1 :  loglikelihood = -667.3399
VGLM    linear loop  2 :  loglikelihood = -629.01907
VGLM    linear loop  3 :  loglikelihood = -626.34081
VGLM    linear loop  4 :  loglikelihood = -626.32467
VGLM    linear loop  5 :  loglikelihood = -626.32467
VGLM    linear loop  6 :  loglikelihood = -626.32467
            loglink(shape1) loglink(shape2) logitlink(pobs0) logitlink(pobs1)
(Intercept)       0.8680077       1.8387140        -2.058975        -2.058975
x2                1.2421898      -0.6163044         1.275530         1.275530

Call:
vglm(formula = y1 ~ x2, family = zoabetaR(parallel.pobs = TRUE), 
    data = bdata, trace = TRUE)

Pearson residuals:
                    Min         1Q     Median      3Q   Max
loglink(shape1)  -9.823 -9.146e-06  2.315e-06  0.6577 1.184
loglink(shape2)  -8.110 -2.061e-06 -1.324e-08  0.6140 1.201
logitlink(pobs0) -0.917 -5.535e-01 -4.216e-01 -0.2251 2.776
logitlink(pobs1) -0.917 -5.535e-01 -4.216e-01 -0.2311 2.779

Coefficients: 
              Estimate Std. Error z value Pr(>|z|)    
(Intercept):1   0.8680     0.1039   8.352  < 2e-16 ***
(Intercept):2   1.8387     0.1073  17.133  < 2e-16 ***
(Intercept):3  -2.0590     0.1119 -18.395  < 2e-16 ***
x2:1            1.2422     0.2014   6.168 6.92e-10 ***
x2:2           -0.6163     0.2021  -3.050  0.00229 ** 
x2:3            1.2755     0.1690   7.549 4.37e-14 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Names of linear predictors: loglink(shape1), loglink(shape2), 
logitlink(pobs0), logitlink(pobs1)

Log-likelihood: -626.3247 on 3994 degrees of freedom

Number of Fisher scoring iterations: 6 

No Hauck-Donner effect found in any of the estimates

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.