Package 'GRCRegression'

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

Help Index


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 λ\lambda.

link.lambda

The link function for λ\lambda.

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))

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 λ\lambda

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 coefficients.

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))

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 “GRCglm.P”.

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)