plot_multivariate {aphylo} | R Documentation |
Multiavariate plot (surface)
Description
Multiavariate plot (surface)
Usage
plot_multivariate(
fun,
params,
domain,
sets,
nlevels = 20,
args = list(),
plotfun = graphics::image,
plot = TRUE,
postplot = function(params, res) {
points(params, cex = 2, pch = 3, col = "red")
},
mfrow = NULL,
...
)
Arguments
fun |
A function that receives 2 or more parameters and returns a single number. |
params |
Numeric vector with the default parameters. |
domain |
(optional) Named list with as many elements as parameters. Specifies the domain of the function. |
sets |
(optional) Character matrix of size |
nlevels |
Integer. Number of levels. |
args |
List of named arguments to be passed to |
plotfun |
Function that will be used to plot |
plot |
Logical. When |
postplot |
Function to be called after |
mfrow |
Passed to graphics::par. |
... |
Further arguments passed to |
Value
A list of length length(sets)
, each with the following:
x,y,z vectors of coordinates.
xlab,ylab vectors with the corresponding labels.
Examples
# Example: A model with less parameters
set.seed(1231)
x <- raphylo(20)
ans <- aphylo_mcmc(
x ~ psi + mu_d + mu_s,
control = list(nsteps = 1e3, burnin = 0)
)
# Creating the multivariate plot (using by default image)
plot_multivariate(
function(...) {
ans$fun(unlist(list(...)), priors = ans$priors, dat = ans$dat, verb_ans = FALSE)
},
sets = matrix(c("mu_d0", "mu_d1", "psi0", "psi1"), ncol=2),
params = ans$par
)