R/compute_gradient.R

Defines functions compute_gradient

Documented in compute_gradient

compute_gradient <-
function(theta, fun, step = 1e-6, ...){
	## Finite difference method to compute the gradient of fun
	## at theta
	#ll <- fun(theta)
	temp <- sapply(1:length(theta), FUN = compute_gradient_coordinate, theta = theta, fun = function(x){fun(x,...)}, step = step)
	names(temp) <- names(theta)
	temp
}

Try the pauwels2014 package in your browser

Any scripts or data that you put into this service are public.

pauwels2014 documentation built on May 29, 2017, 9:03 a.m.