Type: | Package |
Title: | Modified Poisson Regression of Grouped and Right-Censored Counts |
Version: | 1.0 |
Date: | 2023-06-01 |
Depends: | MASS, pracma |
Description: | Implement maximum likelihood estimation for Poisson generalized linear models with grouped and right-censored count data. Intended to be used for analyzing grouped and right-censored data, which is widely applied in many branches of social sciences. The algorithm implemented is described in Fu et al., (2021) <doi:10.1111/rssa.12678>. |
License: | GPL (≥ 3) |
NeedsCompilation: | no |
Author: | Xin Guo [aut, cph, cre], Qiang Fu [aut, cph] |
Maintainer: | Xin Guo <xin.guo@uq.edu.au> |
Packaged: | 2023-06-26 01:50:53 UTC; xin |
Repository: | CRAN |
Date/Publication: | 2023-06-26 12:30:02 UTC |
Maximum likelihood estimation for modified Poisson regression of GRC data
Description
This function implements maximum likelihood estimation of modified Poisson regression of grouped and right-censored counts.
Usage
GRCglm.P(y, x1, scheme, link.lambda = link.log, weights = rep(1, nrow(x1)),
num.intercept = 1, xtol_rel = 1e-08, maxit = 100)
Arguments
y |
A vector of the GRC outcome. |
x1 |
The design matrix. |
scheme |
A vector (sorted) of the starting integers of all GRC groups. |
link.lambda |
The link function for |
weights |
The weight vector used to consider sampling weights. |
num.intercept |
Presence of the regression intercept. Can be set to 0 or 1. This is also used to calculate the null deviance. |
xtol_rel , maxit |
The tolerancethreshold and maximum number of iteration of the algorithm. |
Value
coefficients |
The inferred coefficients. |
beta |
An alias of |
fitting |
The call. |
log.likelihood |
Value of the log likelihood function. |
df.null |
The residual degrees of freedom of the null model. |
df.residual |
The residual degrees of freedom. |
null.deviance |
Null deviance. |
deviance |
The deviance. |
aic , bic |
The AIC and BIC scores. |
McFaddenR2 , McFaddenAdjR2 |
The (rep. Adjusted) McFadden R-square. |
Examples
set.seed(123)
tp <- genData.P(beta = c(0.5, -1, 1), data.size = 120, scheme = c(0:3, 5, 8),
scope.lambda = c(1, 10))
a <- GRCglm.P(y = tp$y, x1 = tp$x, scheme = c(0:3, 5, 8))
Artificial Data Generation
Description
Generate artificial data for testing and verification.
Usage
genData.P(beta, data.size, scheme,
scope.lambda = c(0.01, 100), link.lambda = link.log, seed = list(no = 1),
y.lowRatio = -1)
Arguments
beta |
Coefficients of modified Poisson regression. |
data.size |
The sample size of data to generate. |
scheme |
The grouped and right-censored grouping scheme. A sorted vector containing starting integers of all groups. |
scope.lambda |
A vector of length 2 specifying the range of
|
link.lambda |
The link function for |
seed |
Random seed (optional). |
y.lowRatio |
The minimum proportion of groups in the sample distribution. This optional proportion is included to deal with imbalanced data. |
Value
x |
The design matrix. |
y |
The GRC outcome. |
unused |
An integer roughly describing the number of discarded sample observations in the generating process. If this number is too large, the generation of artificial data is not efficient and takes too much time. |
Examples
set.seed(123)
tp <- genData.P(beta = c(0.5, -1, 1), data.size = 12, scheme = c(0:3, 5, 8))
The log link
Description
The log link function
Usage
link.log()
Arguments
No arguments
Details
This implements the link function g(x)=\log(x)
on the domain (0, \infty)
.
Value
class |
A character |
g |
The link function |
gInv |
The inverse of the link function. |
D.gInv |
The derivative of the inverse link function. |
DD.gInv |
The second-order derivative of the link function. |
Examples
a <- link.log()
Summary of estimates.
Description
A summary of estimates for the class GRCglm.P
.
Usage
## S3 method for class 'GRCglm.P'
summary(object, level = 0.95, ...)
Arguments
object |
An object of class “ |
level |
Level of confidence. |
... |
Reserved parameter for matching other summary methods. |
Value
FisherInfo |
The observed Fisher information matrix. |
stdErr |
Estimated standard error. |
ci |
Confidence intervals of the estimated coefficients. |
WOGRCStdErr |
Estimated standard error for comparision, with Fisher information matrix computed using exact enumeration of counts. |
zValue |
Z-score of the estimated coefficients. |
sigLevel |
P-value of the estimated coefficients. |
Examples
set.seed(123)
tp <- genData.P(beta = c(0.5, -1, 1), data.size = 120, scheme = c(0:3, 5, 8),
scope.lambda = c(1, 10))
a <- GRCglm.P(y = tp$y, x1 = tp$x, scheme = c(0:3, 5, 8))
b <- summary(a)