MoTBF-Distribution {MoTBFs} | R Documentation |
Random generation for mixtures of truncated basis functions defined in a specific domain. The inversion method is used. It is a technique to get random samples from a probability distribution.
rMoTBF(size, fx, domain = NULL)
inversionMethod(size, fx, domain = NULL, data = NULL)
size |
A |
fx |
An object of class |
domain |
A |
data |
A |
rMoTBF()
returns a "numeric"
vector containing the simulated values. inversionMethod()
returns a list with the simulated values and the results of the test, it also shows a plot with the cdf
of the original data and the generated one by screen.
## 1. EXAMPLE
## Data
X <- rnorm(1000, mean = 5, sd = 3)
## Learning
f <- univMoTBF(X, POTENTIAL_TYPE="MOP", nparam=10)
plot(f, xlim = f$Domain)
## Random sample
Y <- rMoTBF(size = 500, fx = f)
ks.test(X,Y)
## Plots
hist(Y, prob = TRUE, add = TRUE)
## 2. EXAMPLE
## Data
X <- rweibull(5000, shape=2)
## Learning
f <- univMoTBF(X, POTENTIAL_TYPE="MOP", nparam=10)
plot(f, xlim = f$Domain)
## Random sample
inv <- inversionMethod(size = 500, fx = f, data = X)
attributes(inv)
inv$test
Y <- inv$sample
## Plots
plot(f, xlim = f$Domain)
hist(Y, prob = TRUE, add = TRUE)