## 1. EXAMPLE
## Univariate MOP integral
X <- rexp(1000)
fx <- univMoTBF(X, POTENTIAL_TYPE = "MOP", scale = FALSE)
integrate.motbf(fx)
integrate.motbf(fx, 2, 6)
## 2. EXAMPLE
## Univariate MOP integral and plot of result
Y <- rnorm(1000)
fy <- univMoTBF(Y, POTENTIAL_TYPE = "MOP")
Fy <- integrate.motbf(fy)
plot(Fy)
integrate.motbf(fy, min(Y), max(Y))
## 3. EXAMPLE
## Univariate MTE integral
Z <- rchisq(1000, df = 3)
fz <- univMoTBF(Z, POTENTIAL_TYPE = "MTE", scale = FALSE)
integrate.motbf(fz)
integrate.motbf(fz, lower = 2, upper = 5)
if (FALSE) {
## 4. EXAMPLE
Px <- "1+x+5"
class(Px)
integrate.motbf(Px)
## Error in integrate.motbf(Px) : Argument "f" is not of class "motbf"
}
## 5. EXAMPLE: Joint MOP integral
## Dataset with 2 variables
data <- data.frame(x = rnorm(100), y = rnorm(100))
## Joint function
dim <- c(2, 3)
P <- jointmotbf.fit(data, dimensions = dim)
## Integral
integrate.motbf(P)
integrate.motbf(P, var = "x")
integrate.motbf(P, var = "y")
##############################################################################
## MORE EXAMPLES #############################################################
##############################################################################
# \donttest{
## Dataset with 3 variables
data <- data.frame(x = rnorm(50), y = rnorm(50), z = rnorm(50))
## Joint function
dim <- c(2,2,3)
P = jointmotbf.fit(data, dimensions = dim)
## Integral
integrate.motbf(P)
integrate.motbf(P, var="x")
integrate.motbf(P, var=c("x","z"))
# }
Run the code above in your browser using DataLab