1. Home
  2. R0KEEP procedure

R0KEEP procedure

Saves information from a zero-inflated regression model for count data with excess zeros fitted by R0INFLATED (D.A. Murray).

Options

RESIDUALS = variate Saves the simple residuals
FITTEDVALUES = variate Saves the fitted values
ESTIMATE = variate Saves the parameter estimates
SE = variate Saves the standard errors of the parameter estimates
VCOVARIANCE = symmetric matrix Saves the variance-covariance matrix of estimates for the ZIP, ZIB and ZINB models
XFITTEDVALUES = variate Saves the fitted values for the count model
XSEFITTEDVALUES = variate Saves the standard errors of the fitted values for the fitted values of the count model
ZFITTEDVALUES = variate Saves the fitted values for the zero model
ZSEFITTEDVALUES = variate Saves the standard errors of the fitted values for the fitted values of the zero model
_2LOGLIKELIHOOD = scalar Saves -2 times the log-likelihood
AIC = scalar Saves the Akaike information coefficient
SIC = scalar Saves the Schwarz (Bayesian) information coefficient

No parameters

Description

This procedure allows you to copy information into Genstat data structures from a model that has been fitted to count data with excess zeros by procedure R0INFLATED. You do not need to declare the structures in advance; Genstat will declare them automatically to be of the correct type and length.

The RESIDUALS and FITTEDVALUES options save the simple residuals and the fitted values. The ESTIMATES and SE options save the parameter estimates and their standard errors. The VCOVARIANCE option saves the variance-covariance matrix of estimates from either a ZIP or ZINB model. The ZFITTEDVALUES and ZSEFITTEDVALUES options save the fitted values and standard errors of fitted values for the zero state. Similarly, the XFITTEDVALUES and XSEFITTEDVALUES options save the fitted values and standard errors of fitted values for the count state. The _2LOGLIKELIHOOD option saves -2 times the log-likelihood, and the AIC and SIC options save the Akaike and Schwarz (Bayesian) information coefficients respectively.

Options: RESIDUALS, FITTEDVALUES, ESTIMATES, SE, VCOVARIANCE, XFITTEDVALUES, XSEFITTEDVALUES, ZFITTEDVALUES, ZSEFITTEDVALUES, _2LOGLIKELIHOOD, AIC, SIC.

Parameters: none.

See also

Procedure: R0INFLATED.

Commands for: Regression analysis.

Example

CAPTION    'R0KEEP example - EM algorithm',\
           !t('Apple shoot data: Ridout et al.',\
              'Models for count data with many zeros, IBC Cape Town 1998');\
           STYLE=meta,plain
FACTOR     [LABELS=!T('0.5','1','2','4'); VALUES=30(1,2),\ 
           40(3,4),30(1,2,3),40(4)] Hormone
FACTOR     [LABELS=!T('8','16'); VALUES=140(1),130(2)] Period
READ       NShoots
1 1 1 2 2 3 3 3 4 4 4 4 4 4 5 5 5 6 6 7 7 8 8 8 9 10 10 11 13 17
2 2 2 4 6 6 6 7 7 7 7 7 7 7 8 8 8 9 9 9 9 9 10 10 10 11 11 11 11 13
2 3 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8
8 8 8 8 8 8 9 9 9 9 9 10 10 10 10 11 12 12 14 14
0 0 3 3 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 
8 8 8 8 8 8 8 8 9 9 9 10 10 10 10 11 11 11 11 14
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 3 3 4 5 5 6 8 9 9 9 10 11 12
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 3 4 4 5 6 6 8 10 10 10 12
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 2 2 3 4 4 5 5 6 6 6 7 9 9 11 12
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 
1 2 2 3 3 3 3 4 4 4 5 6 6 6 6 7 7 7 9 9 :
R0INFLATED [PRINT=mod,est,sum; CONSTANT=estimate; XTERMS=Hormone*Period; \
           ZCONSTANT=estimate; ZTERMS=Period] NShoots
R0KEEP     [ESTIMATES=est; SE=se; VCOVARIANCE=vcov]
PRINT      est,se
PRINT      vcov

CAPTION    'R0KEEP example - Conditional Model',\
           !t('Leadbeater''s Possum data: Welsh et al.',\
              'Modelling the abundance of rare species: statistical models ',\
              'for counts with extra zeros. Ecological Modelling');\
           STYLE=meta,plain
DELETE     [REDEFINE=yes] no_lb,stags,lstags
VARIATE    [NVALUES=151] no_lb,stags
READ       no_lb
  7  0  0  3  2 10  7  3  0  0  0  0  0  2  0  1  0  4  3  2 10  7  0  3  7  0
  0  0  0  0  5  9  0  0  0  0  1  0  5  4  0  0  4  0  4  0  2  0  0  1  1  0
  3  0  0  0  0  0  2  0  0  1  0  2  5  3  0  0  0  0  0  0  0  0  5  0  0  0
  0  0  0  1  5  4  0  0  0  0  3  0  3  3  1  0  0  0  0  0  2  0  0  1  0  3
  0  0  4  0  0  3  4  0  8  5  3  0  0  0  5  5  0  2  0  0  0  0  0  2  0  2
  0  0  0  0  0  4  0  0  0  0  5  0  0  0  0  0  1  0  0  0  0 :
READ       stags
 12 15  6 14 16 16  9 20  7  4  6  5  4  6  4 10  6 11 11  4 16  8 10  9  7 10
 15  5  7 10 11  8  8  3 14  5  8 14 11  2  1  1  7  2  7  7  1  6  8  6  6  5
  6  0  0  2  0  1  3  2  2  6  3  4  3  4  5  2  3  4  4  2  2 10 16 10  4  3
  2  2  2  2  3  1  6  8  2  4 12 13  3 14  2  4  0  2  3 14 29  2  4  6  3  8
  4  7 20  4 11  5  1  2 27 24  9 18  3 20 25  4  4 30 24  8  4  6  5  3  5  2
  3  5  7  4  5  4  4  1  4 23 25 31  0  8  4  4  1  3  1  1  4 :
CALCULATE  lstags = log(stags+1)
R0INFLATED [PRINT=mod,sum,est; METHOD=conditional;\ 
           ZTERMS=lstags; XTERMS=lstags] no_lb
R0KEEP     [RESIDUALS=res; FITTEDVALUES=fitted; ESTIMATES=estc; SE=sec]
PRINT      estc,sec
PRINT      res,fitted 
Updated on June 18, 2019

Was this article helpful?