Learn R Programming

AGPRIS (version 2.0)

inla.st: Space-time bayesian INLA estimator

Description

This function estimates a space time linear model using the bayesian INLA. It is a wrapper of the INLA::inla function (Lindgren and Rue (2015) tools:::Rd_expr_doi("10.18637/jss.v063.i19"); Bivand, Gomez-Rubio and Rue (2015) tools:::Rd_expr_doi("10.18637/jss.v063.i20")) adapted to panel data.

Usage

inla.st(
  formula,
  d,
  W,
  RHO,
  PHI,
  var.agg,
  normalization = FALSE,
  improve = TRUE,
  fhyper = NULL,
  probit = FALSE,
  ...
)

Value

Returns a model of class "inla". Please, refer to the documentation of the INLA package for additional information

Arguments

formula

Formula of the model to be estimated

d

Data frame

W

Spatial matrix

RHO

Parameter of spatial dependence

PHI

Parameter of temporal dependence

var.agg

Indexes of the panel dimensions. The first argument is the spatial dimension, the second argument is the temporal dimension.

normalization

Boolean. If TRUE the data are normalized before estimation

improve

Please refer to the documentation of the INLA package

fhyper

Plase refer to the documentation of the INLA package

probit

Plase refer to the documentation of the INLA package

...

additional parameters. Please, refer to the documentation of the INLA package

Examples

Run this code
# \donttest{
library(terra)
set.seed(123)
sd = sim_data_fe(dataset=regsamp,N=100,TT=8,spatial = 80,
                 Tau = -0.2,Rho = 0.4, Beta = 2,sdDev = 2,
                 startingT = 10,LONGLAT = TRUE)
est_inla = inla.st(formula = Y~-1+X1,d = sd[[1]]@data,
               W = sd[[2]],PHI=-0.2,RHO=0.4,
               var.agg=c('Cod_Provincia','Anno'),
               family='gaussian',
               improve=TRUE,
               normalization=FALSE,
               control.family = list(hyper = list(prec=list(initial=25,fixed=TRUE))),
               control.predictor = list(compute = TRUE),
               control.compute = list(dic = TRUE, cpo = TRUE),
               control.inla = list(print.joint.hyper = TRUE))
summary(est_inla)
# }

Run the code above in your browser using DataLab