rfitdistr.RdFits a parametric distribution to a (standardized) input vector using
misc::fit_param_dist, and generates random draws from the fitted
distribution. Useful for simulating residuals or innovations whose
distribution is estimated from data rather than assumed.
rfitdistr(x, n = length(x), p = 1)a numeric vector used to fit the distribution (the vector is centered and scaled internally before fitting)
number of observations to simulate per column/path
(default length(x))
number of columns/paths to simulate; if p <= 1, a vector
of length n is returned, otherwise a matrix of dimension
n x p is returned (default 1)
If p <= 1, a numeric vector of length n containing
simulated values. If p > 1, a numeric matrix with n rows and
p columns containing simulated values.
x <- rnorm(100)
res <- rfitdistr(x, n = 10, p = 5)