Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top