# How to extract spatially varying coefficients in Bsptime function in bmstdr package?

Hi,

I am doing a Bayesian analysis using a spatially varying coefficient model and
I am concerned about how I can extract these spatially varying coefficients for
all 3 variables as given in example below.
It is simple to get these spatially varying coefficients from the spTDyn package
as shown below. However, the spTDyn package takes a huge amount of time
to run the model when we get a couple of more variables, and
the iteration is in thousands. I thought calling the spTDyn in the Bsptime function
computes the results much faster than spTDyn by itself? Could there be any
simple method to get these coefficients? I will then map each of the seven
spatially varying coefficients separately.

I could use the spSVC function from the spBayes package that could finish much faster than the other packages but extracting the spatially varying coefficients is still a problem. Any tips for the spSVC function would be appreciated as well.

``````library(spTDyn)
library(bmstdr)
library(spBayes)

data("nysptime")

f <- y8hrmax~ xmaxtemp + sp(xmaxtemp)+ xwdsp + sp(xwdsp) + xrh + sp(xrh)

# using the spTDyn package
model1 <-  GibbsDyn(formula = f, data = nysptime, coords  =  ~utmx + utmy,
spatial.decay = decay(distribution = Gamm(2,1),tuning = 0.06))

# obtain parameter summary with spatially varying coefficients
summary(model1, coefficient = "spatial")

# calling the spTDyn package in Bsptime function in bmstdr package
model2 <- Bsptime(package = "sptDyn", model = "GP", formula = f, data = nysptime,
coordtype = "utm", coords = 4:5)
``````

Thanks for your time and help in this regard.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.