Package 'uniah'

Title: Unimodal Additive Hazards Model
Description: Nonparametric estimation of a unimodal or U-shape covariate effect under additive hazards model.
Authors: Yunro Chung [aut, cre]
Maintainer: Yunro Chung <[email protected]>
License: GPL (>= 2)
Version: 1.2
Built: 2026-05-13 06:07:27 UTC
Source: https://github.com/cran/uniah

Help Index


Fit Unimodal Additive Hazards Model

Description

Nonparametric estimation of a unimodal or U-shape covariate effect for additive hazard model.

Details

Package: uniah
Type: Package
Version: 1.2
Date: 2024-01-20
License: GPL (>= 2)

Author(s)

Yunro Chung [aut,cre] Maintainer: Yunro Chung <[email protected]>

References

Yunro Chung, Anastasia Ivanova, Jason P. Fine, Shape restricted addtive hazards model (in preparation).


Fit Unimodal Additive Hazards Model

Description

Nonparametric estimation of a unimodal or U-shape covariate effect for additive hazard model.

Usage

uniah(formula, trt, data, shape, mode, M, maxdec, maxiter, eps)

Arguments

formula

a formula object: a response ~ a univariate covariate. The response must be survival outcome unsing the Surv function.

trt

Treatment group. It must be coded by 0 or 1. This argument is optional.

data

data.frame or list that includes variables named in the formula argument.

shape

direction of the covariate effect on the hazard function, "unimodal" or "ushape"

mode

mode of the unimodal or ushape hazard function, "known" or "unknown" (default is "unknown").

M

A value for mode, which is only requred when mode="known".

maxdec

maximum number of decisimal for output (default is 3).

maxiter

maximum number of iteration (default is 10^3).

eps

stopping convergence criteria (default is 10^-3).

Details

The uniah function allows to analyze shape restricted additive hazards model, defined as

λ(tz,trt)=λ0(t)+ψ(z)+βtrt,\lambda(t|z,trt)=\lambda0(t)+\psi(z)+\beta trt,

where λ0\lambda0 is a baseline hazard function, ψ\psi is a unimodal or U-shaped function, zz is a univariate variable, β\beta is a regression parameter, and trttrt is a binary treatment group variable. One point at mode has to be fixed with ψ(M)=0\psi(M)=0 for model identifiability. For known mode (mode="known"), MM has to be prespecified, and (ψ,β\psi, \beta) is estimated given the prespecified MM. For unknown mode (mode="unknown"), MM is not needed, and (ψ,β,M\psi , \beta, M) is estimated by profiling all hypothetical modes. A direction of ψ\psi is defined as unimodal or ushape prior to data analysis. Monotone covariate effects are also considered by setting a mode to the left or right end point of ZZ.

Value

A list of class isoph:

est

results.

psi

estimated ψ\psi at z

beta

estimated β\beta.

conv

algorithm convergence status.

M

Predetermined model if mode="known" or estimated mode if mode="unknown".

shape

Direction of ψ\psi.

call

Specified arguments that are specified in the model.

Author(s)

Yunro Chung [aut, cre]

References

Yunro Chung, Anastasia Ivanova, Jason P. Fine, Shape restricted addtive hazards model (in preparation).

Examples

###
# 1. unimodal with known mode
###
# 1.1. create a test data set
test1=list(
  time=  c(9, 7, 5, 9, 5, 3, 8, 7, 9, 7),
  status=c(1, 1, 0, 1, 0, 1, 1, 1, 1, 1),
  z=     c(2, 8, 1, 3, 2, 4, 4, 6, 8, 3)
)

# 1.2. Fit isotonic proportional hazards model
res1=uniah(Surv(time,status)~z, data=test1, shape='unimodal', mode='known', M=5)

# 1.3. print result
res1

# 1.4 figure
plot(res1)

###
# 2. unimodal with known mode with treatment group
###
# 2.1. create a test data set 1
test2=list(
  time=  c(2, 7, 3, 7, 8, 1, 2, 2, 9, 8),
  status=c(1, 0, 1, 1, 1, 0, 0, 1, 1, 0),
  z=     c(4, 9, 5, 5, 1, 3, 8, 8, 1, 2),
  trt=   c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0)
)

# 2.2. Fit isotonic proportional hazards model
res2=uniah(Surv(time,status)~z, trt=trt, data=test2, shape='unimodal', mode='known', M=6)

# 2.3. print result
res2

# 2.4 figure
plot(res2)

###
# 3. ushape with unknown mode
###
# 3.1. create a test data set
test3=list(
  time=  c(3, 4, 5, 4, 1, 8, 1, 9, 2, 8, 2, 5, 7, 2, 2, 3, 3, 1, 1, 8),
  status=c(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1),
  z=     c(10,4, 6, 9, 2, 9, 9, 7, 6, 1, 2, 2, 7, 4, 8, 5, 7,10, 4, 8)
)

# 3.2. Fit isotonic proportional hazards model
res3=uniah(Surv(time,status)~z, data=test3, shape='ushape', mode='unknown')

# 3.3 print result
res3

# 3.4 Figure
plot(res3)

###
# 4. More arguments for plot.uniah
###
# 4.1 renames labels
#plot(res3, main="Ush", ylab="RD", xlab="Cov", lglab="Cov wt obs", lgloc="center", lgcex=1.5)

# 4.2 removes labels and changes line and point parameters
#plot(res3, main=NA, ylab=NA, xlab=NA, lglab=NA, lty=2, lcol=2, lwd=2, pch=3, pcol=4, pcex=1.5)