user2472273
user2472273

Reputation: 125

Simulating Weibull distributions from vectors of parameters in R

I have a vector of 365 shape parameters and a vector of 365 scale parameters from Weibull distribution.

How can I simulate 365 values from corresponding parameters in R?

The background of my question is: I have daily average wind speed which follows a Weibull distribution of unique parameters. Now, I would need to simulate daily wind speed from the data.

Upvotes: 1

Views: 1047

Answers (1)

asb
asb

Reputation: 4432

Use the rweibull function. Btw, do you want just one simulated value per parameter pair?

Anyhow, this should do it for nobs number of observations. You can choose n=1 as well.

simulations <- mapply(rweibull, shapes, scales, MoreArgs=list(n=nobs))

where shapes is your vector containing the shape parameters, and similarly scales is the vector containing the scale parameter values.

Upvotes: 3

Related Questions