sim_data_fe {AGPRIS} | R Documentation |
This function simulates a space-time stochastic process according to the defined spatial structure and input paramters. It simulates data of a dynamic spatial lag model. It includes one exogenous variable and a fixed-effect correlated with the exogenous variable.
sim_data_fe( dataset, N, TT, spatial = 100, Tau = -0.14, Rho = 0.67, Beta = 1, sdDev = 5, startingT = 11, LONGLAT = TRUE )
dataset |
SpatialObject with the spatial units for which the data will be simulated |
N |
How many spatial units will be used |
TT |
Time dimension of the simulated process |
spatial |
Radius that defines the scope of spatial dependence |
Tau |
Autocorrelation parameter |
Rho |
Spatial dependence parameter |
Beta |
Coefficient associated to the exogenous variable |
sdDev |
Standard Deviation of the (gaussian) error term |
startingT |
The number of time periods after which the simulated data will be recorded |
LONGLAT |
Boolean. If the projection is longlat |
A list with two objects. The first object is the STFDF with the simulated data. The second object is the spatial weight matrix
library(spacetime) library(sp) library(spdep) set.seed(123) sd = sim_data_fe(dataset=regsamp,N=100,TT=8, spatial = 80,Tau = -0.2,Rho = 0.4, Beta = 2,sdDev = 2,startingT = 10, LONGLAT = TRUE) stplot(sd[[1]][,,'Y']) dev.new() plot(sel_regioni) points(coordinates(sd[[1]]@sp)) plot(mat2listw(sd[[2]]),coordinates(sd[[1]]@sp),add=TRUE,col=2)