| Library: | hazreg |
| See also: | harefit haresummary xhare |
| Quantlet: | plothare | |
| Description: | plots a hare density, distribution function, hazard function or survival function for a model estimated by harefit. |
| Usage: | plothare(fit{,cov,what,n,which,time,xlim,type}) | |
| Input: | ||
| fit | a list like the output from harefit. | |
| cov | a (1 x fit.ncov) matrix, indicating for which combination of covariates the plot should be made (fit.ncov is the number of covariates used during fitting the model). Can be omitted only if fit.ncov is 0. | |
| what | an optional string containing one or more letters separated by commas specifying what should be plotted (default is "d"): d (density), p (distribution function), s (survival function) or h (hazard function). | |
| n | an optional number of equally spaced points at which to plot the fit (default is 100). | |
| which | an optional number (default is 0) setting for which coordinate the plot should be made. 0: time; positive value i: covariate i. Note that if which is the positive value i, then the element corresponding to this covariate must be given in cov even though its actual value is irrelevant. | |
| time | a time vector; if which is not equal to 0, the value of time for which the plot should be made. Otherwise, it can be omitted. | |
| xlim | an optional 2 x 1 vector containing lower and upper bounds for x-axis. | |
| type | an optional one-character string indicating what type of plot should be drawn. Possible types are "p" for points, and "l" for lines (default). | |
library("hazreg")
randomize(111)
n = 500
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
fit=harefit(t,delta,z)
haresummary(fit)
plothare(fit,1.1~1.4,"p,s")
Along with the summary, the estimated distribution and survival functions are plotted. Contents of sum [ 1,] "dim A/D loglik AIC penalty " [ 2,] " min max" [ 3,] " 0 Add -1.6e-46 -9.2e+102 1.4e+02 1.4e+02" [ 4,] " 0 Add 5.6e+175 -5.9e-144 42 42" [ 5,] " 0 Add 9.7e+43 -6.2e-127 1.3 1.3" [ 6,] " 0 Add -7.3e-252 2.7e-273 0.00" [ 7,] " " [ 8,] "the present optimal number of dimensions is 3." [ 9,] "penalty(AIC) was the default: BIC=log(samplesize): log(500)=6.2" [10,] " " [11,] " dim1 dim2 beta SE Wald" [12,] "Constant 0.21 0.32 0.64" [13,] "Co-2 linear 1.8 0.16 11" [14,] "Co-1 linear 1 0.16 6.5"