Use the cumulative distribution function of Weibull in R

扶醉桌前 提交于 2019-12-02 00:17:14

问题


I have to simulate a system's fail times, to do so I have to use the Weibull distribution with a "decreasing hazard rate" and a shape of "0.7-0.8". I have to generate a file with 100 results for the function that uses random numbers from 0 to 1.

So I've been searching a bit and I found this R function:

    pweibull(q, shape, scale = 1, lower.tail = T, log.p = F)

There are some other (rweibull,qweibull...) but I think this is the one that I have to use, since is the cumulative distribution one, as the exercise statement says. The problem is that I am new to R and that I don't really know what parameters I have to pass to this function.

I'm guessing shape should be 0.7-0.8, and scale 1. For q parameter, should I create a random vector of 100 numbers with 0 to 1 values? If so, any tip of how to do it? Also any tip on how to export the resultant data to a file?


回答1:


I'm not sure what the question is, but if you want to generate 100 values drawn from Weibull distribution with shape parameter of 0.75 use rweibull(100, 0.75).

If you want to see what the probability is that they are larger than zero, use pweibull(rweibull(100, 0.75), 0.75).

You should also be aware that there is a general no-homework rule on these sites.



来源:https://stackoverflow.com/questions/17768765/use-the-cumulative-distribution-function-of-weibull-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!