Description Usage Arguments Value Examples
Calculates the profile likelihood of a parameterized conductance surface across a grid of parameter values (e.g. the nuisance parameters are optimized at each point on the grid).
1 2 3 4 5 6 7 8 9 10 11 | radish_grid(
theta,
formula,
data,
conductance_model = radish::loglinear_conductance,
measurement_model = radish::mlpe,
nu = NULL,
nonnegative = TRUE,
conductance = TRUE,
covariance = FALSE
)
|
theta |
A matrix of dimension (grid size) x (number of parameters) |
formula |
A formula with the name of a matrix of observed genetic distances on the lhs, and covariates in the creation of |
data |
An object of class |
conductance_model |
A function of class |
measurement_model |
A function of class |
nu |
Number of genetic markers (potentially used by |
nonnegative |
Force regression-like |
conductance |
If |
covariance |
If |
An object of class radish_grid
, containing:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | library(raster)
data(melip)
covariates <- raster::stack(list(altitude = raster::scale(melip.altitude),
forestcover = raster::scale(melip.forestcover)))
fit_mlpe <- radish(melip.Fst ~ altitude * forestcover, data = surface,
radish::loglinear_conductance, radish::mlpe)
theta <- as.matrix(expand.grid(forestcover=seq(-1,1,length.out=21),
altitude=seq(-1,1,length.out=21)))
grid <- radish_grid(theta, melip.Fst ~ forestcover + altitude, surface,
radish::loglinear_conductance, radish::mlpe)
library(ggplot2)
ggplot(data.frame(loglik=grid$loglik, grid$theta),
aes(x=forestcover, y=altitude)) +
geom_tile(aes(fill=loglik)) +
geom_contour(aes(z=loglik), color="black") +
annotate(geom = "point", colour = "red",
x = coef(fit_mlpe)["forestcover"],
y = coef(fit_mlpe)["altitude"]) +
theme_bw() +
xlab(expression(theta[altitude])) +
ylab(expression(theta[forestcover]))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.