data.weibull: Random data set generating function.

Description Usage Arguments Details Value Author(s) Examples

View source: R/data.weibull.R

Description

Generate random data set of weibull distributed failure time, covariates and corresponding censoring status with a given shape and a set of regression parameters. Correlated covariates can also be drawn with a given number of correlated covariates.

Usage

1
2
data.weibull(n, shape = 2, regco = c(1, 3), rcen = 0.25, ncorvar = 3, 
correlated = FALSE)

Arguments

n

sample size

shape

value of shape parameter

regco

vector of regression parameters that corresponds to covariates, for correlated = FALSE

rcen

censoring rate

ncorvar

no of correlated covariates, for correlated = TRUE. See details below.

correlated

logical; if true correlated covariates will be generated with a given no of correlated covariates

Details

ncorvar is non required if correlated = FALSE and regco is not required if correlated = TRUE.

Value

Data frame with columns:

ftime

lifetime data from weibull distribution

x

covariates

delta

censoring status, 0 or 1. A value 0 indicates corresponding observation is censored

Author(s)

Mazharul Islam and Hasinur Rahaman Khan

Examples

1
2
3
data.weibull(n = 20)
data.weibull(n = 20, shape=1.7, regco=c(2,1,3,4))
data.weibull(n = 20, shape=1.5, ncorvar=4, correlated=TRUE)

Example output

Loading required package: survival
Loading required package: MASS
       ftime         x1         x2 delta
1  5.5285051 0.01825500 0.76984909     1
2  1.6811140 0.24665820 0.11919649     1
3  3.2054426 0.58924707 0.61226851     1
4  4.1722637 0.67273321 0.52851914     1
5  5.0110929 0.30118537 0.89722350     1
6  2.6900875 0.75709108 0.21139642     1
7  2.8383086 0.74855660 0.76416580     1
8  3.1576081 0.09721157 0.74808237     0
9  2.9870133 0.71354583 0.65525743     1
10 4.2251690 0.47055266 0.93662024     1
11 3.8548061 0.09370593 0.56201747     0
12 4.9765836 0.42335303 0.94037335     1
13 1.4585501 0.50286922 0.06119989     0
14 7.5036330 0.24207294 0.94430023     1
15 3.1080147 0.48320021 0.27399907     1
16 3.0347549 0.76174261 0.65480418     1
17 1.2913088 0.26753738 0.20687737     1
18 1.7081739 0.12938265 0.03195374     1
19 0.6572288 0.48336809 0.06385313     1
20 2.5900849 0.70655513 0.82503060     1
        ftime         x1         x2         x3         x4 delta
1   1.7591574 0.48895197 0.51761414 0.94783679 0.12702849     1
2   7.3066656 0.33860026 0.10418987 0.83089183 0.47006116     1
3   5.6640033 0.91860804 0.76865910 0.06800085 0.29369470     1
4  11.8021209 0.83116912 0.87340684 0.12005294 0.93947178     0
5   5.8346460 0.23754037 0.91648091 0.07708892 0.73645608     0
6   5.5170374 0.53142018 0.25102757 0.48899650 0.56631368     0
7   4.9772100 0.34814745 0.31923140 0.56896707 0.72724784     1
8   2.9762220 0.35510713 0.69555422 0.33111285 0.04525866     1
9   3.9826208 0.25005544 0.51062742 0.63474262 0.62464867     1
10  0.5291483 0.96667684 0.38975192 0.21265227 0.22315152     1
11  2.4060400 0.61877205 0.70149986 0.27306367 0.60447994     1
12 11.6563045 0.72048235 0.74638697 0.25999403 0.08771913     1
13 10.2811909 0.03729592 0.99167551 0.71759676 0.98862901     1
14  3.8653466 0.66801935 0.97248495 0.21415337 0.20270901     1
15  1.3593653 0.02073816 0.32865457 0.33824482 0.19675015     1
16 14.5608605 0.83454387 0.26738802 0.50591333 0.97270514     1
17  8.8231974 0.68289613 0.59220147 0.52443549 0.62242043     1
18  3.3848888 0.64392464 0.04399232 0.39001369 0.82313560     0
19  4.3990387 0.38945267 0.34275350 0.59909000 0.19967283     1
20  1.4605024 0.61379839 0.36641330 0.12751954 0.98288194     1
        ftime       x1       x2       x3       x4 delta
1  22.7575066 5.979719 5.791697 5.490143 4.961273     1
2  11.0640008 6.103569 5.633859 5.966207 5.396877     1
3   4.9277428 3.197703 3.936553 2.908292 4.327912     0
4  37.2995514 4.963802 4.885824 4.122696 3.938070     0
5  14.5305134 4.727272 3.540627 4.402988 4.809045     1
6  18.0983987 3.147721 4.578854 3.875326 2.677945     1
7   7.7780033 6.159772 5.812586 5.240550 4.898950     1
8  34.0687087 4.077360 3.670701 4.518825 3.968879     0
9   9.5602195 5.583241 5.284334 4.361992 4.695983     1
10 19.3382165 3.554495 3.814267 3.659040 3.279019     0
11  8.2993946 3.804916 4.783440 4.298398 4.799240     1
12  0.6835952 4.381773 4.657757 3.582894 4.405798     1
13 15.3102565 5.276127 4.825016 4.536843 5.553946     1
14 11.3650201 4.945651 5.494872 5.320811 5.945011     0
15 11.6018515 3.599004 3.515798 3.333251 3.929236     1
16 45.3525173 3.921258 3.485051 5.084968 4.308731     1
17  5.6228149 5.163803 4.495212 5.023717 4.032901     1
18 42.5102139 4.217659 4.978060 4.117231 6.000722     1
19 11.1442800 5.544063 5.534483 5.323767 4.532580     1
20 41.9696700 6.254060 6.303641 5.155098 5.842869     1

MPLikelihoodWB documentation built on May 2, 2019, 10:25 a.m.