Title: | Modified Poisson Regression of Grouped and Right-Censored Counts |
---|---|
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>. |
Authors: | Xin Guo [aut, cph, cre], Qiang Fu [aut, cph] |
Maintainer: | Xin Guo <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0 |
Built: | 2025-03-09 04:25:50 UTC |
Source: | https://github.com/cran/GRCRegression |
Generate artificial data for testing and verification.
genData.P(beta, data.size, scheme, scope.lambda = c(0.01, 100), link.lambda = link.log, seed = list(no = 1), y.lowRatio = -1)
genData.P(beta, data.size, scheme, scope.lambda = c(0.01, 100), link.lambda = link.log, seed = list(no = 1), y.lowRatio = -1)
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. |
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. |
set.seed(123) tp <- genData.P(beta = c(0.5, -1, 1), data.size = 12, scheme = c(0:3, 5, 8))
set.seed(123) tp <- genData.P(beta = c(0.5, -1, 1), data.size = 12, scheme = c(0:3, 5, 8))
This function implements maximum likelihood estimation of modified Poisson regression of grouped and right-censored counts.
GRCglm.P(y, x1, scheme, link.lambda = link.log, weights = rep(1, nrow(x1)), num.intercept = 1, xtol_rel = 1e-08, maxit = 100)
GRCglm.P(y, x1, scheme, link.lambda = link.log, weights = rep(1, nrow(x1)), num.intercept = 1, xtol_rel = 1e-08, maxit = 100)
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. |
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. |
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))
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))
The log link function
link.log()
link.log()
No arguments
This implements the link function
on the domain
.
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. |
a <- link.log()
a <- link.log()
A summary of estimates for the class GRCglm.P
.
## S3 method for class 'GRCglm.P' summary(object, level = 0.95, ...)
## S3 method for class 'GRCglm.P' summary(object, level = 0.95, ...)
object |
An object of class “ |
level |
Level of confidence. |
... |
Reserved parameter for matching other summary methods. |
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. |
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)
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)