% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spde1.R
\name{inla.spde1.create}
\alias{inla.spde1.create}
\alias{inla.spde1.matern}
\alias{inla.spde1.imatern}
\alias{inla.spde1.matern.osc}
\alias{inla.spde1}
\title{Old SPDE model objects for INLA}
\usage{
inla.spde1.create(
  mesh,
  model = c("matern", "imatern", "matern.osc"),
  param = NULL,
  ...
)

inla.spde1.matern(mesh, ...)

inla.spde1.imatern(mesh, ...)

inla.spde1.matern.osc(mesh, ...)
}
\arguments{
\item{mesh}{The mesh to build the model on, as an \code{\link[=inla.mesh]{inla.mesh()}}
object.}

\item{model}{The name of the model.}

\item{param}{Model specific parameters.}

\item{...}{Additional parameters passed on to other methods.}
}
\value{
An \code{inla.spde1} object.
}
\description{
Create an \code{inla.spde1} model object.
}
\details{
Note: This is an old spde object format retained for backwards
compatibility.  Please use \code{\link[=inla.spde2]{inla.spde2()}} models for new code.

This method constructs an object for SPDE models.  Currently implemented:

\code{model="matern"}

\deqn{(\kappa^2(u)-\Delta)^{\alpha/2}(\tau(u) }{(kappa^2(u)-Delta)^(alpha/2)
(tau(u) x(u)) = W(u)}\deqn{ x(u))=W(u)}{(kappa^2(u)-Delta)^(alpha/2) (tau(u)
x(u)) = W(u)}

\code{param}: \itemize{ \item\code{alpha} = 1 or 2 \item\code{basis.T} =
Matrix of basis functions for \eqn{\log\tau(u)}{log tau(u)}
\item\code{basis.K} = Matrix of basis functions for
\eqn{\log\kappa^2(u)}{log kappa^2(u)} }

\code{model="imatern"}

\deqn{(-\Delta)^{\alpha/2}(\tau(u) }{(-Delta)^(alpha/2) (tau(u) x(u)) =
W(u)}\deqn{ x(u))=W(u)}{(-Delta)^(alpha/2) (tau(u) x(u)) = W(u)}

\code{param}: \itemize{ \item\code{alpha} = 1 or 2 \item\code{basis.T} =
Matrix of basis functions for \eqn{\log\tau(u)}{log tau(u)} }
}
\examples{

n <- 100
field.fcn <- function(loc) (10 * cos(2 * pi * 2 * (loc[, 1] + loc[, 2])))
loc <- matrix(runif(n * 2), n, 2)
## One field, 2 observations per location
idx.y <- rep(1:n, 2)
y <- field.fcn(loc[idx.y, ]) + rnorm(length(idx.y))

mesh <- inla.mesh.create(loc, refine = list(max.edge = 0.05))
spde <- inla.spde1.create(mesh, model = "matern")
data <- list(y = y, field = mesh$idx$loc[idx.y])
formula <- y ~ -1 + f(field, model = spde)
result <- inla(formula, data = data, family = "normal")

## Plot the mesh structure:
plot(mesh)
\donttest{
if (require(rgl)) {
    ## Plot the posterior mean:
    plot(mesh,
        rgl = TRUE,
        result$summary.random$field[, "mean"],
        color.palette = colorRampPalette(c("blue", "green", "red"))
    )
    ## Plot residual field:
    plot(mesh,
        rgl = TRUE,
        result$summary.random$field[, "mean"] - field.fcn(mesh$loc),
        color.palette = colorRampPalette(c("blue", "green", "red"))
    )
}
}

}
\seealso{
\code{\link[=inla.spde2.matern]{inla.spde2.matern()}}, \code{\link[=inla.mesh.2d]{inla.mesh.2d()}},
\code{\link[=inla.mesh.basis]{inla.mesh.basis()}}
}
\author{
Finn Lindgren \email{finn.lindgren@gmail.com}
}
