fit_terms {pspatreg}R Documentation

Compute terms of the non-parametric covariates in the semiparametric regression models.

Description

The fit_terms function compute both:

Usage

fit_terms(object, variables, intercept = FALSE)

Arguments

object

object fitted using pspatfit function.

variables

vector including names of non-parametric covariates. To fit the terms of non-parametric spatial (2d) or spatio-temporal (3d) trend this argument must be set equal to 'spttrend'. See examples in this function.

intercept

add intercept to fitted term. Default = FALSE.

Value

A list including:

fitted_terms Matrix including terms in columns.
se_fitted_terms Matrix including standard errors of terms in columns.
fitted_terms_fixed Matrix including fixed part of terms in columns.
se_fitted_terms_fixed Matrix including standard errors of fixed part of terms in columns.
fitted_terms_random Matrix including random part of terms in columns.
se_fitted_terms_random Matrix including standard errors of random part of terms in columns.

This object can be used as an argument of plot_terms function to make plots of both non-parametric trends and smooth functions of covariates. See examples below.

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

See Also

Examples

###################### Examples using a panel data of rate of unemployment 
###################### in 103 Italian provinces during the period 1996-2014.
library(pspatreg)
data(unemp_it, package = "pspatreg")
lwsp_it <- spdep::mat2listw(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 <- pspatfit(form1, data = unemp_it, 
                    type = "sar", listw = lwsp_it)
summary(gamsar)

######  Fit non-parametric terms 
######  (spatial trend must be name "spttrend")
list_varnopar <- c("serv", "empgrowth")
terms_nopar <- fit_terms(gamsar, list_varnopar)

######################  Plot non-parametric terms
plot_terms(terms_nopar, unemp_it)
 

[Package pspatreg version 1.1.2 Index]