在R中使用Weibull的累积分布函数 [英] Use the cumulative distribution function of Weibull in R
问题描述
我必须模拟系统的故障时间,为此,我必须使用Weibull分布,其危险率降低"且形状为"0.7-0.8".我必须为该函数生成一个包含100个结果的文件,该函数使用从0到1的随机数.
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.
所以我一直在搜索,发现了这个R函数:
So I've been searching a bit and I found this R function:
pweibull(q, shape, scale = 1, lower.tail = T, log.p = F)
还有其他一些(rweibull,qweibull ...),但是我认为这是我必须使用的,因为如锻炼说明所述,这是累积分布之一.问题是我不熟悉R,并且我真的不知道必须向该函数传递哪些参数.
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.
我猜形状应该为0.7-0.8,比例为1.对于q参数,我是否应该创建一个100个数字的随机矢量,其值是0到1?如果是这样,该如何做?还有关于如何将结果数据导出到文件的提示吗?
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?
推荐答案
我不确定问题是什么,但是如果您想从Weibull分布中生成100个形状参数为0.75的值,请使用rweibull(100, 0.75)
.
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)
.
如果要查看它们大于零的可能性,请使用pweibull(rweibull(100, 0.75), 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.
这篇关于在R中使用Weibull的累积分布函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!