Density (dhare), cumulative probability (phare), hazard rate (hhare), quantiles (qhare), and random samples (rhare) from a hare object.

dhare(q, cov, fit) 
hhare(q, cov, fit) 
phare(q, cov, fit) 
qhare(p, cov, fit) 
rhare(n, cov, fit)

Arguments

q

vector of quantiles. Missing values (NAs) are allowed.

p

vector of probabilities. Missing values (NAs) are allowed.

n

sample size. If length(n) is larger than 1, then length(n) random values are returned.

cov

covariates. There are several possibilities. If a vector of length fit\$ncov is provided, these covariates are used for all elements of p or q or for all random numbers. If a matrix of dimension length(p), length(q), or n by fit\$ncov is provided, the rows of cov are matched with the elements of p or q or every row of cov has its own random number. If a matrix of dimension m times fit\$ncov is provided, while length(p) = 1 or length(q) = 1 or n = 1, the single element of p or q is used m times, or m random numbers with different sets of covariates are generated.

fit

hare object, typically obtained from hare.

Value

Densities (dhare), hazard rates (hhare), probabilities (phare), quantiles (qhare), or a random sample (rhare) from a hare object.

Details

Elements of q or p that are missing will cause the corresponding elements of the result to be missing.

References

Charles Kooperberg, Charles J. Stone and Young K. Truong (1995). Hazard regression. Journal of the American Statistical Association, 90, 78-94.

Charles J. Stone, Mark Hansen, Charles Kooperberg, and Young K. Truong. The use of polynomial splines and their tensor products in extended linear modeling (with discussion) (1997). Annals of Statistics, 25, 1371–1470.

Author

Charles Kooperberg clk@fredhutch.org.

Examples

fit <- hare(testhare[,1], testhare[,2], testhare[,3:8])
dhare(0:10, testhare[117,3:8], fit)
#>  [1] 0.002266272 0.152470629 0.287974746 0.129592312 0.059521788 0.029785596
#>  [7] 0.019564779 0.018506767 0.017505968 0.016559291 0.015663807
hhare(0:10, testhare[1:11,3:8], fit)
#>  [1] 0.001552441 0.070309445 0.269493885 0.145167330 0.054224645 0.066780728
#>  [7] 0.046037322 0.070017965 0.040146964 0.021650719 0.093524484
phare(10, testhare[1:25,3:8], fit)
#>  [1] 0.5123317 0.3576253 0.7043853 0.5752294 0.3917284 0.6544619 0.3770862
#>  [8] 0.4427595 0.4709139 0.2394673 0.7899024 0.3089936 0.2685960 0.8907437
#> [15] 0.5178234 0.7405306 0.8203810 0.5384936 0.6828870 0.3309411 0.4975142
#> [22] 0.2711855 0.6696873 0.4463595 0.4508892
qhare((1:19)/20, testhare[117,3:8], fit)
#>  [1]  0.9111681  1.2177157  1.4661735  1.6823984  1.8757295  2.0522630
#>  [7]  2.2285926  2.4405426  2.7052796  3.0517090  3.5395492  4.3268016
#> [13]  6.0983534  8.8711194 12.1506055 16.1643721 21.3390173 28.6322700
#> [19] 41.1001679
rhare(10, testhare[117,3:8], fit)
#>  [1]  4.6770640 43.6611030  1.1726776  9.4671562 26.0956371  1.6515889
#>  [7]  2.6942694  3.4179223  2.1676257  0.7634546