| Library: | hazreg |
| See also: | hazdat hazregll hazbeta |
| Quantlet: | haztest | |
| Description: | calculates the value of the test statistic, the degree of freedom, and the P-value of the likelihood ratio, Wald's and scores tests for the Cox Proportional Hazard model, by Newton-Raphson method. |
| Usage: | {val, df, pval} = haztest(data, index) | |
| Input: | ||
| data | n x (p+4) matrix, the first column is the sorted survival time t, followed by the sorted delta, inidcating if censoring has occured, labels l, a column containing the number of ties, and lastly, the sorted covariate matrix z. | |
| index | p x 1 vector, with ith element = 0 when beta_i = 0 is in the null hypothesis, and 1, otherwise. | |
| Output: | ||
| val | 3 x 1 vector, values of the test statistics. | |
| df | scalar, degree of freedom. | |
| pval | 3 x 1 vector, P-values of the tests. | |
library("hazreg")
n = 20
p = 2
beta = 1|2 ; regression parameter
z = 1 + uniform(n,p) ; covariates
y = -log(1-uniform(n)) ; exponential survival
y = y./exp(z*beta) ; covariate effects
c = 4*uniform(n) ; uniform censoring
t = min(y~c,2) ; censored time
delta = (y<=c) ; censoring indicator
{data,ties} = hazdat(t,delta, z) ; preparing data
index = 1|0 ; testing if the second
; coefficient is zero
{val,df,pval} = haztest(data, index)
; test results
The second parameter of beta is test to be zero or not by likelihood ratio, Wald's and scores tests.
| Library: | hazreg |
| See also: | hazdat hazregll hazbeta |