plot_sptime {pspatreg}R Documentation

Plot of time trends for spatio-temporal models in 3d.

Description

Make plots of the temporal trends for each region fitted with pspatfit function.

Usage

plot_sptime(object, data, time_var, reg_var)

Arguments

object

object returned from pspatfit

data

either sf or dataframe with the data.

time_var

name of the temporal variable in data.

reg_var

name of the regional variable in data.

Value

time series plots of the temporal trend for each region

Author(s)

Roman Minguez roman.minguez@uclm.es
Roberto Basile roberto.basile@univaq.it
Maria Durban mdurban@est-econ.uc3m.es
Gonzalo Espana-Heredia gehllanza@gmail.com

References

Examples

library(pspatreg)
data(unemp_it, package = "pspatreg")
lwsp_it <- spdep::mat2listw(Wsp_it)

###### FORMULA OF THE MODEL
form3d_psanova <- unrate ~ partrate + agri + cons +
                  pspl(serv, nknots = 15) + 
                  pspl(empgrowth, nknots = 20) +
                  pspt(long, lat, year, 
                       nknots = c(18, 18, 8),
                       psanova = TRUE, 
                       nest_sp1 = c(1, 2, 3), 
                       nest_sp2 = c(1, 2, 3),
                       nest_time = c(1, 2, 2))


####### FIT the model
sp3danova <- pspatfit(form3d_psanova, 
                      data = unemp_it, 
                      listw = lwsp_it, 
                      method = "Chebyshev") 

summary(sp3danova)

######## Plot of temporal trend for each province 
plot_sptime(sp3danova, 
            data = unemp_it, 
            time_var = "year", 
            reg_var = "prov")



[Package pspatreg version 1.1.2 Index]