3

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?

Andre Silva
  • 4,782
  • 9
  • 52
  • 65
Golan_trevize
  • 2,353
  • 5
  • 22
  • 22
  • The rweibull (and runif, rnorm) function is the one that generates samples from a distribution. The pweibull is the distribution function, dweibull the density. If you don't know what those things are then 30 hours isn't enough, unless someone here is mad enough to do your homework for you (which will need a lot of clarification because your question isn't that clear) – Spacedman Jul 21 '13 at 08:07
  • @Golan_trevize if i've answered your question you should mark the tick -- you get status for doing so, which will help your questions get more attention over time. – ricardo Jul 21 '13 at 13:09

1 Answers1

7

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.

ricardo
  • 8,195
  • 7
  • 47
  • 69
  • The policy isn't that clearcut: http://meta.stackexchange.com/questions/18242/what-is-the-policy-here-on-homework but this question doesn't show much effort. – Spacedman Jul 21 '13 at 07:58
  • @Spacedman i didn't realise - glad to see i kep to the spirit of the consensus. – ricardo Jul 21 '13 at 08:02