spatialbayesianlm: spatially constrained bayesian regression function.

View source: R/spatialbayesianlm.R

spatialbayesianlmR Documentation

spatially constrained bayesian regression function.

Description

Take a standard lm result and use bayesian regression to impose spatial regularity.

Usage

spatialbayesianlm(
  mylm,
  ymat,
  mask,
  smth = 1,
  priorWeight = 1,
  nhood = NA,
  regweights = NA,
  smoothcoeffmat = NA
)

Arguments

mylm

standard lm result of the form mylm<-lm(ymat~.)

ymat

outcome matrix - usually from imaging data

mask

mask with non-zero entries n-columns of ymat

smth

smoothness parameter

priorWeight

weight on the prior

nhood

size of neighborhood

regweights

weights on rows - size of ymat

smoothcoeffmat

prior coefficient matrix

Value

bayesian regression solution is output as a list of images

Author(s)

Avants BB

Examples


# make some simple data
## Not run: 
if (!exists("fn")) fn <- getANTsRData("pcasl")
asl <- antsImageRead(fn)
tr <- antsGetSpacing(asl)[4]
aslmean <- getAverageOfTimeSeries(asl)
aslmask <- getMask(aslmean, lowThresh = mean(aslmean), cleanup = TRUE)
pcaslpre <- aslPerfusion(asl,
  dorobust = 0, useDenoiser = NULL, skip = 1,
  useBayesian = 0, moreaccurate = 0, verbose = T, mask = aslmask
)
# user might compare to useDenoiser=FALSE
pcasl.parameters <- list(sequence = "pcasl", m0 = pcaslpre$m0)
aslmat <- timeseries2matrix(asl, aslmask)
tc <- as.factor(rep(c("C", "T"), nrow(aslmat) / 2))
dv <- computeDVARS(aslmat)
perfmodel <- lm(aslmat ~ tc + stats::poly(dv, 4)) # standard model
ssp <- spatialbayesianlm(perfmodel, aslmat, aslmask,
  priorWeight = 1.e2, smth = 1.6, nhood = rep(2, 3)
)
plot(ssp[[1]], slices = "2x16x2", axis = 3)

## End(Not run)


stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.