Skip to contents

compute_mesh create objects required for INLA analysis of an object of class "CRTsp".

Usage

compute_mesh(
  trial = trial,
  offset = -0.1,
  max.edge = 0.25,
  inla.alpha = 2,
  maskbuffer = 0.5,
  pixel = 0.5
)

Arguments

trial

an object of class "CRTsp" or a data frame containing locations in (x,y) coordinates, cluster assignments (factor cluster), and arm assignments (factor arm) and outcome.

offset

see inla.mesh.2d documentation

max.edge

see inla.mesh.2d documentation

inla.alpha

parameter related to the smoothness (see inla documentation)

maskbuffer

numeric: width of buffer around points (km)

pixel

numeric: size of pixel (km)

Value

list

  • prediction Data frame containing the prediction points and covariate values

  • A projection matrix from the observations to the mesh nodes.

  • Ap projection matrix from the prediction points to the mesh nodes.

  • indexs index set for the SPDE model

  • spde SPDE model

  • pixel pixel size (km)

Details

compute_mesh carries out the computationally intensive steps required for setting-up an INLA analysis of an object of class "CRTsp", creating the prediction mesh and the projection matrices. The mesh can be reused for different models fitted to the same geography. The computational resources required depend largely on the resolution of the prediction mesh. The prediction mesh is thinned to include only pixels centred at a distance less than maskbuffer from the nearest point.
A warning may be generated if the Matrix library is not loaded.

Examples

{
# low resolution mesh for test dataset
library(Matrix)
example <- readdata('exampleCRT.txt')
exampleMesh=compute_mesh(example, pixel = 0.5)
}
#> Warning: package 'Matrix' was built under R version 4.3.2
#> Mesh of 183 pixels of size 0.5 km