summary.bru {inlabru} | R Documentation |
Summary for an inlabru fit
Description
Takes a fitted bru
object produced by bru()
or lgcp()
and creates
various summaries from it.
Usage
## S3 method for class 'bru'
summary(object, verbose = FALSE, ...)
## S3 method for class 'summary_bru'
print(x, ...)
Arguments
object |
|
verbose |
logical; If |
... |
arguments passed on to component summary functions, see
|
x |
A |
Examples
if (bru_safe_inla(multicore = FALSE)) {
# Simulate some covariates x and observations y
input.df <- data.frame(x = cos(1:10))
input.df <- within(input.df, y <- 5 + 2 * x + rnorm(10, mean = 0, sd = 0.1))
# Fit a Gaussian likelihood model
fit <- bru(y ~ x + Intercept, family = "gaussian", data = input.df)
# Obtain summary
fit$summary.fixed
}
if (bru_safe_inla(multicore = FALSE)) {
# Alternatively, we can use the like() function to construct the likelihood:
lik <- like(family = "gaussian", formula = y ~ x + Intercept, data = input.df)
fit <- bru(~ x + Intercept(1), lik)
fit$summary.fixed
}
# An important addition to the INLA methodology is bru's ability to use
# non-linear predictors. Such a predictor can be formulated via like()'s
# \code{formula} parameter. The z(1) notation is needed to ensure that
# the z component should be interpreted as single latent variable and not
# a covariate:
if (bru_safe_inla(multicore = FALSE)) {
z <- 2
input.df <- within(input.df, y <- 5 + exp(z) * x + rnorm(10, mean = 0, sd = 0.1))
lik <- like(
family = "gaussian", data = input.df,
formula = y ~ exp(z) * x + Intercept
)
fit <- bru(~ z(1) + Intercept(1), lik)
# Check the result (z posterior should be around 2)
fit$summary.fixed
}
[Package inlabru version 2.11.1 Index]