eff_par | R Documentation |
Compute direct, indirect and total effects (also named impacts) for non-parametric covariates included in a semiparametric spatial or spatio-temporal SAR model. This model must include a spatial lag of the dependent variable (SAR) to have indirect effects different from 0, otherwise, total and direct effects are the same.
eff_par(sptsarfit, variables, nrep = 1000, seed = 1111, m = 100, p = 50, tol = 0.01)
sptsarfit |
A psar object fitted using |
variables |
vector including names of non-parametric covariates. |
nrep |
number of repetitions for the simulation. Default 1000. |
seed |
initial seed to get random numbers. Must be set to a specific value to make reproducible results. Default 1111. |
m |
number of powers to compute a vector of traces of powers
of a spatial weight matrix (see |
p |
number of samples used in MC simulation of traces
of a spatial weight matrix (see |
tol |
tolerance (relative to largest variance) for numerical lack
of positive-definiteness in Sigma when simulate βs
from the maximum likelihood estimates (see |
DESCRIBE ALGORITHM TO SIMULATE PARAMETRIC EFFECTS
An object of class par.eff.psar. Can be printed
with summary
.
The object returned is a list with 3 matrices including the results of simulated effects:
tot_eff | Matrix including simulated total effects for each variable in rows. |
dir_eff | Matrix including simulated direct effects for each variable in rows. |
ind_eff | Matrix including simulated indirect effects for each variable in rows. |
LeSage, J. and Pace, K. (2009). Introduction to Spatial Econometrics. CRC Press, Boca Raton.
psar
estimate spatial or spatio-temporal
semiparametric PS-SAR regression models.
eff_nopar
compute total, direct and indirect effect
functions for non-parametric continuous covariates.
fit_terms
compute smooth functions for non-parametric
continuous covariates.
impacts
similar function in spdep
package to compute impacts in spatial parametric econometric
models.
Other Direct, Indirect and Total Effects.: eff_nopar
,
plot_eff_nopar
################################################ ###################### Examples using a panel data of rate of ###################### unemployment for 103 Italian provinces in period 1996-2014. library(sptpsar) data(unemp_it); Wsp <- Wsp_it ###################### No Spatial Trend: PSAR including a spatial ###################### lag of the dependent variable form1 <- unrate ~ partrate + agri + cons + pspl(serv,nknots=15) + pspl(empgrowth,nknots=20) gamsar <- psar(form1,data=unemp_it,sar=TRUE,Wsp=Wsp_it) summary(gamsar) ###### Parametric Total, Direct and Indirect Effects list_varpar <- c("partrate","agri","cons") eff_parvar <- eff_par(gamsar,list_varpar) summary(eff_parvar) ###################### PSAR-ANOVA with spatial trend form2 <- unrate ~ partrate + agri + cons + pspl(serv,nknots=15) + pspl(empgrowth,nknots=20) + pspt(long,lat,nknots=c(20,20),psanova=TRUE, nest_sp1=c(1,2),nest_sp2=c(1,2)) ##### Spatial trend fixed for period 1996-2014 geospanova_sar <- psar(form2,data=unemp_it,Wsp=Wsp_it,sar=TRUE, control=list(thr=1e-1,maxit=200,trace=FALSE)) summary(geospanova_sar) ###### Parametric Total, Direct and Indirect Effects list_varpar <- c("partrate","agri","cons") eff_parvar <- eff_par(geospanova_sar,list_varpar) summary(eff_parvar) ###################### PSAR-ANOVA with spatio-temporal trend and ###################### temporal autorregresive noise form3 <- 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),ntime=19) sptanova_sar_ar1 <- psar(form3,data=unemp_it,Wsp=Wsp_it,sar=TRUE,ar1=TRUE, control=list(thr=1e-1,maxit=200,trace=FALSE)) summary(sptanova_sar_ar1) ###### Parametric Total, Direct and Indirect Effects list_varpar <- c("partrate","agri","cons") eff_parvar <- eff_par(sptanova_sar_ar1,list_varpar) summary(eff_parvar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.