LogLike: Individual log-likelihood

Description Usage Arguments Value Examples

Description

'LogLike' calculates the individual log-likelihood which is needed for 'Clarketest' and 'Vuongtest'.

Usage

1
LogLike(Yin, fm.X, region, regmodel, thinning = 1, burnin = 1)

Arguments

Yin

response vector of length n.

fm.X

formula for mean design.

region

region of each observation.

regmodel

the output of model fits obtained by using 'est.sc'.

thinning

number of MCMC iterations between two writing steps (if thinning=1 (default), all states are calculated whereas if e.g. thinning=10 only each 10 iteration is calculated)

burnin

number of steps dropped from the chain to allow for a burn-in phase. Defaults to 1.

Value

ll

is a matrix of dimension (n x (totalit+2)), where each column represents one iteration and contains the likelihood contributions of each observation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(sim.Yin)
data(sim.fm.X)
data(sim.region)
data(sim.gmat)
data(sim.nmat)

poi <- est.sc(sim.Yin, ~1+sim.fm.X[,1]+sim.fm.X[,2], sim.region, 
model="Poi", sim.gmat, sim.nmat, 3)

ll.poi <- LogLike(sim.Yin, ~1+sim.fm.X[,1]+sim.fm.X[,2], sim.region, poi)

# log likelihood for the single iterations
apply(ll.poi$ll,2,sum)

spatcounts documentation built on May 29, 2017, 11:04 p.m.