View source: R/effects_nopar.R
| eff_nopar | R Documentation |
Compute direct, indirect and total effect functions 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 function effects are the same.
eff_nopar(sptsarfit, variables, conflevel = 0.95)
sptsarfit |
psar object fitted using |
variables |
vector including names of non-parametric covariates. |
conflevel |
numerical value for the confidence interval of the effect functions. Default 0.95. |
DESCRIBE ALGORITHM TO COMPUTE EFFECT FUNCTIONS AND THE SMOOTHING TO PLOT
A list including
| effnopar_tot | Matrix including total effects in columns. |
| effnopar_dir | Matrix including direct effects in columns. |
| effnopar_ind | Matrix including indirect effects in columns. |
| effnopar_tot_up | Matrix including upper bounds of total effects in columns. |
| effnopar_dir_up | Matrix including upper bounds of direct effects in columns. |
| effnopar_ind_up | Matrix including upper bounds of indirect effects in columns. |
| effnopar_tot_low | Matrix including lower bounds of total effects in columns. |
| effnopar_dir_low | Matrix including lower bounds of direct effects in columns. |
| effnopar_ind_low | Matrix including lower bounds of indirect effects in columns. |
Roman Minguez roman.minguez@uclm.es
Basile, R., Durbán, M., Mínguez, R., Montero, J. M., and Mur, J. (2014). Modeling regional economic dynamics: Spatial dependence, spatial heterogeneity and nonlinearities. Journal of Economic Dynamics and Control, (48), 229-245.
LeSage, J. and Pace, K. (2009). Introduction to Spatial Econometrics. CRC Press, Boca Raton.
Mínguez, R.; Basile, R. and Durbán, M. (2018). An Alternative Semiparametric Model for Spatial Panel Data. Under evaluation in Statistical Methods and Applications.
psar estimate spatial or spatio-temporal semiparametric PS-SAR
regression models.
eff_par compute and simulate total, direct and indirect effect
(or impacts) for parametric continuous covariates.
fit_terms compute terms for smooth functions for non-parametric
continuous covariates and for non-parametric trends.
plot_effects_nopar plot the non-parametric effects functions
allowing for previous smoothing.
Other Direct, Indirect and Total Effects.: eff_par,
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)
###### Non-Parametric Total, Direct and Indirect Effects
list_varnopar <- c("serv","empgrowth")
eff_nparvar <- eff_nopar(gamsar,list_varnopar)
plot_effects_nopar(eff_nparvar,unemp_it,smooth=TRUE)
plot_effects_nopar(eff_nparvar,unemp_it,smooth=FALSE)
###################### 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)
###### Non-Parametric Total, Direct and Indirect Effects
list_varnopar <- c("serv","empgrowth")
eff_nparvar <- eff_nopar(geospanova_sar,list_varnopar)
plot_effects_nopar(eff_nparvar,unemp_it,smooth=TRUE)
plot_effects_nopar(eff_nparvar,unemp_it,smooth=FALSE)
###################### 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)
###### Non-Parametric Total, Direct and Indirect Effects
list_varnopar <- c("serv","empgrowth")
eff_nparvar <- eff_nopar(sptanova_sar_ar1,list_varnopar)
plot_effects_nopar(eff_nparvar,unemp_it,smooth=TRUE)
plot_effects_nopar(eff_nparvar,unemp_it,smooth=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.