coxphlb.ftest: Test the Functional Form of Covariates in Cox Model with...

Description Usage Arguments Details Value References See Also Examples

Description

Tests the functional form of covariates assumed for a Cox model fit (coxphlb).

Usage

1
2
coxphlb.ftest(fit, data, spec.p = 1, n.sim = 1000, z0 = NULL,
seed.n = round(runif(1,1,1e09)), digits = 3L)

Arguments

fit

The result of fitting a Cox model, using the coxphlb function.

data

A data frame containing the variables in the model.

spec.p

An integer specifying which covariate to be tested. Default is 1. If set to 1, the first column of the covariate matrix is tested.

n.sim

The number of resampling. Default is 1000.

z0

A vector of grid points to use for the specified covariate. The default is a vector of 100 equally distributed numeric values within the range of the specified covariate.

seed.n

An integer specifying seed number.

digits

An integer controlling the number of digits to print.

Details

The functional form of a continuous covariate is checked by constructing test statistics based on asymptotically mean-zero processes. The asymptotic distribution of the test statistics is approximated via resampling. This function computes the p-value by comparing the test statistics with n.sim number of resamples. If the p-value is small (e.g., <0.05), it is likely that the assumption is violated. The test should be done per variable for continuous covariates.

Value

A list containing the following components:

p.value

A p-value.

The list is returned as an object of the coxphlb.ftest class. Objects of this class have methods for the function print. The object also contains the following: n.sim; z0; stat.mat.z, the test statistic; sim.mat.z, samples from the null distribution; varnames, the variable that is tested; result, the table output.

References

Lee, C.H., Ning, J., and Shen, Y. Model diagnostics for proportional hazards model with length-biased data. Lifetime Data Analysis 25(1), 79-96.

See Also

coxphlb, coxphlb.phtest, coxphlb.ftest.plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# Fit a Cox model
fit.ee <- coxphlb(Surv(a, y, delta) ~ x1 + x2, data = ExampleData1,
                 method = "EE")

# Check the Functional Form of the Cox Model
ftest <- coxphlb.ftest(fit.ee, data = ExampleData1, spec.p = 2,
                      seed.n = 1234)
print(ftest)			# display the results

## End(Not run)

Example output

sh: 1: cannot create /dev/null: Permission denied
Loading required package: survival
Call:
coxphlb(formula = Surv(a, y, delta) ~ x1 + x2, method = EE)
   coef  variance std.err z.score p.value lower.95 upper.95
x1 1.029 0.031    0.177   5.83    <0.001  0.683    1.375   
x2 0.45  0.132    0.364   1.24    0.216   -0.263   1.163   
   p.value
x2 0.433  
   p.value
x2 0.433  

CoxPhLb documentation built on May 2, 2019, 12:21 p.m.