loglik.dCAR: Likelihood computing and parameter estimation for a direct...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/loglik.dCAR.R

Description

This help page documents a few functions for exact evaluation of the log-likelihood and profile log-likelihood for a direct CAR model, the maximum pseudo-likelihood estimator, and least square estimators for beta and sigma given the spatial coefficient rho in the CAR covariance matrix. The exact evaluation computes the log determinant in the log-likelihood function with eigen-values of the spatial weight matrix.

Usage

1
2
3
4
5
6
7
loglik.dCAR(pars, data, rho.cons = c(-0.249, 0.249))
ploglik.dCAR(rho, data)

get.beta.lm(rho, data)
sigmabeta(rho, data)

mple.dCAR(data, tol = 1e-06, rho0=0)

Arguments

pars

the parameter value to be evaluated

rho

the value of the spatial coefficient in the CAR covariance to be evaluated

data

a list containing the following objects:

W

the spatial weight matrix,

lambda

the eigenvalues of W (if given),

data.vec

a data frame of the response variable and covariates.

rho.cons

rho domain interval

tol

tolerance for the relative difference for two consequtive iterations in finding the MPLE; default set to be = 1e-06

rho0

starting value for iteratively finding the MPLE; default value set to be 0.

Details

The eigen-values can be supplied in the data list if the likelihood for the same data is going to be evaluated many times; if not supplied the function use the function eigen to find the eigen-values of the weight matrix.

Value

loglik.dCAR and ploglik.dCAR return a numeric value of the log-likelihood evaluation. get.beta.lm, sigmabeta and mple return a numeric array of the estimates.

Author(s)

Zhe Sha zhesha1006@gmail.com

See Also

CAR.simLM, get.beta.glm, mcl.dCAR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Simulate data from a torus
set.seed(30)
n.torus <- 20
rho <- 0.15
sigma <- 1.5
beta <- c(1, 2)
XX <- cbind(rep(1, n.torus^2), log(1:n.torus^2))
mydata <- CAR.simTorus(n.torus, n.torus, rho, 1/sigma)
y <- XX %*% beta + mydata$X
mydata$data.vec <- data.frame(y=y, XX[,-1])

## evaluate the log-likelihood without lambda
loglik.dCAR(pars = c(0.1, 1, 0.9, 2.1), data = mydata)

## evaluate the log-likelihood with lamda
lambda <- eigen(mydata$W, symmetric = TRUE, only.values=TRUE)$values
mydata$lambda <- lambda
loglik.dCAR(pars = c(0.1, 1, 0.9, 2.1), data = mydata)

## evaluate the profile log-likelihood of rho
ploglik.dCAR(rho = 0.1, data = mydata)

## given rho = 0.1, find the least square estimates for beta and sigma
get.beta.lm(rho = 0.1, data = mydata)
sigmabeta(rho = 0.1, data = mydata)

## find the maximum pseudo-likelihood estimates
mple.dCAR(data = mydata)

mclcar documentation built on Jan. 8, 2022, 5:07 p.m.