pwreg: Fit a standard proportional win-fractions (PW) regression...

Description Usage Arguments Value References See Also Examples

View source: R/functions.R

Description

Fit a standard proportional win-fractions (PW) regression model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
pwreg(
  ID,
  time,
  status,
  Z,
  rho = 0,
  strata = NULL,
  fixedL = TRUE,
  eps = 1e-04,
  maxiter = 50
)

Arguments

ID

a vector of unique subject-level identifiers.

time

a vector of event times.

status

a vector of event type labels. 0: censoring, 1:death and 2: non-fatal event.

Z

a matrix or a vector of covariates.

rho

a non-negative number as the power of the survival function used in the weight. Default (rho=0) is recommended. If there is a 'strata' argument, then 'rho' is ignored.

strata

a vector of stratifying variable if a stratified model is desired.

fixedL

logical variable indicating which variance estimator to be used. If 'TRUE', the type I variance estimator (for a small number strata) is used; otherwise the type II variance estimator (for a large number strata) is used.

eps

precision for the convergence of Newton-Raphson algorithm.

maxiter

maximum number of iterations allow for the Newton-Raphson algorithm.

Value

An object of class pwreg with the following components. beta:a vector of estimated regression coefficients. Var:estimated covariance matrix for beta. conv: boolean variable indicating whether the algorithm converged within the maximum number of iterations.

References

Mao, L. and Wang, T. (2020). A class of proportional win-fractions regression models for composite outcomes. Biometrics, 10.1111/biom.13382

Wang, T. and Mao, L. (2021+). Stratified Proportional Win-fractions Regression Analysis.

See Also

score.proc, print.pwreg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
library(WR)
head(non_ischemic)
id_unique <-unique(non_ischemic$ID)

# Randomly sample 200 subjects from non_ischemic data
set.seed(2019)
id_sample <- sample(id_unique, 200)
non_ischemic_reduce <- non_ischemic[non_ischemic$ID %in% id_sample, ]

# Use the reduced non_ischemic data for analysis
nr <- nrow(non_ischemic_reduce)
p <- ncol(non_ischemic_reduce)-3
ID <- non_ischemic_reduce[,"ID"]
time <- non_ischemic_reduce[,"time"]
status <- non_ischemic_reduce[,"status"]
Z <- as.matrix(non_ischemic_reduce[,4:(3+p)],nr,p)
## unstratified analysis
pwreg.obj <- pwreg(time=time,status=status,Z=Z,ID=ID)
print(pwreg.obj)
## Not run: 
## stratified PW by sex
sex<-Z[,3]
## take out sex from the covariate matrix
Z1<-Z[,-3]
pwreg.obj1 <- pwreg(time=time,status=status,Z=Z1,ID=ID,strata=sex)
print(pwreg.obj1)

## End(Not run)

WR documentation built on Nov. 27, 2021, 1:06 a.m.