LogLike {spatcounts}R Documentation

Individual log-likelihood

Description

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

Usage

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

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, 200)

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)

[Package spatcounts version 1.0 Index]