Description Usage Arguments Value Examples
View source: R/apis_functions.R
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.
1 2 3 4 5 6 7 8 9 10 11 12 | sim_data_fe(
dataset,
N,
T,
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 |
T |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
library(spacetime)
library(sp)
library(spdep)
set.seed(123)
sd = sim_data_fe(dataset=regsamp,N=100,T=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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.