spatialbayesianlm: spatially constrained bayesian regression function.

Description Usage Arguments Value Author(s) Examples

View source: R/spatialbayesianlm.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
  # 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)

neuroconductor-devel/ANTsR documentation built on April 1, 2021, 1:02 p.m.