Description Usage Arguments Value References Examples
View source: R/radish_algorithm.R
Calculates likelihood, gradient, hessian, and partial derivatives of a parameterized conductance surface, given a function mapping spatial data to conductance and a function mapping resistance distance (covariance) to genetic distance; using the algorithm in Pope (in prep).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
f |
A function of class 'conductance_model' |
g |
A function of class 'measurement_model' |
s |
An object of class 'radish_graph' |
S |
A matrix of observed genetic distances |
theta |
Parameters for conductance surface (e.g. inputs to 'f') |
nu |
Number of genetic markers (potentially used by 'g') |
objective |
Compute negative loglikelihood? |
gradient |
Compute gradient of negative loglikelihood wrt theta? |
hessian |
Compute Hessian matrix of negative loglikelihood wrt theta? |
partial |
Compute partial derivatives of negative loglikelihood wrt theta and spatial covariates/observed genetic distances |
nonnegative |
Force regression-like 'measurement_model' to have nonnegative slope? |
validate |
Numerical validation via 'numDeriv' (very slow, use for debugging small examples) |
A list containing at a minimum:
covariance |
rows/columns of the generalized inverse of the graph Laplacian for a subset of target vertices |
Additionally, if 'objective == TRUE':
objective |
(if 'objective') the negative loglikelihood |
phi |
(if 'objective') fitted values of the nuisance parameters of 'g' |
boundary |
(if 'objective') is the solution on the boundary (e.g. no genetic structure)? |
fitted |
(if 'objective') matrix of expected genetic distances among target vertices |
gradient |
(if 'gradient') gradient of negative loglikelihood with respect to theta |
hessian |
(if 'hessian') Hessian matrix of the negative loglikelihood with respect to theta |
partial_X |
(if 'partial') Jacobian of the gradient with respect to the spatial covariates |
partial_S |
(if 'partial') Jacobian of the gradient with respect to the observed genetic distances |
Pope NS. In prep. Fast gradient-based optimization of resistance surfaces.
1 2 3 4 5 6 7 8 9 | library(raster)
data(melip)
covariates <- raster::stack(list(altitude=melip.altitude, forestcover=melip.forestcover))
surface <- radish_conductance_surface(covariates, melip.coords, directions = 8)
radish_algorithm(radish::loglinear_conductance, radish::leastsquares, surface,
ifelse(melip.Fst < 0, 0, melip.Fst), nu = 1000, theta = c(-0.3, 0.3))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.