plot.aghq {aghq} | R Documentation |
Plot method for AGHQ objects
Description
Plot the marginal pdf and cdf of the transformed parameter from an aghq
object.
Usage
## S3 method for class 'aghq'
plot(x, ...)
Arguments
x |
The return value of |
... |
not used. |
Value
Silently plots.
See Also
Other quadrature:
aghq()
,
get_hessian()
,
get_log_normconst()
,
get_mode()
,
get_nodesandweights()
,
get_numquadpoints()
,
get_opt_results()
,
get_param_dim()
,
laplace_approximation()
,
marginal_laplace_tmb()
,
marginal_laplace()
,
nested_quadrature()
,
normalize_logpost()
,
optimize_theta()
,
print.aghqsummary()
,
print.aghq()
,
print.laplacesummary()
,
print.laplace()
,
print.marginallaplacesummary()
,
summary.aghq()
,
summary.laplace()
,
summary.marginallaplace()
Other quadrature:
aghq()
,
get_hessian()
,
get_log_normconst()
,
get_mode()
,
get_nodesandweights()
,
get_numquadpoints()
,
get_opt_results()
,
get_param_dim()
,
laplace_approximation()
,
marginal_laplace_tmb()
,
marginal_laplace()
,
nested_quadrature()
,
normalize_logpost()
,
optimize_theta()
,
print.aghqsummary()
,
print.aghq()
,
print.laplacesummary()
,
print.laplace()
,
print.marginallaplacesummary()
,
summary.aghq()
,
summary.laplace()
,
summary.marginallaplace()
Examples
logfteta2d <- function(eta,y) {
# eta is now (eta1,eta2)
# y is now (y1,y2)
n <- length(y)
n1 <- ceiling(n/2)
n2 <- floor(n/2)
y1 <- y[1:n1]
y2 <- y[(n1+1):(n1+n2)]
eta1 <- eta[1]
eta2 <- eta[2]
sum(y1) * eta1 - (length(y1) + 1) * exp(eta1) - sum(lgamma(y1+1)) + eta1 +
sum(y2) * eta2 - (length(y2) + 1) * exp(eta2) - sum(lgamma(y2+1)) + eta2
}
set.seed(84343124)
n1 <- 5
n2 <- 5
n <- n1+n2
y1 <- rpois(n1,5)
y2 <- rpois(n2,5)
objfunc2d <- function(x) logfteta2d(x,c(y1,y2))
funlist2d <- list(
fn = objfunc2d,
gr = function(x) numDeriv::grad(objfunc2d,x),
he = function(x) numDeriv::hessian(objfunc2d,x)
)
thequadrature <- aghq(funlist2d,3,c(0,0))
plot(thequadrature)