Learn R Programming

spdgp (version 0.1.0)

sim_error: Simulate Spatial Error Process

Description

This function generates a pure spatial error process, which is useful when you only want to simulate the error structure without including any deterministic part (i.e., no xb term). This can be used to analyze or simulate the behavior of spatially dependent errors in isolation.

Usage

sim_error(u, listw, lambda = 0.5, model = c("sar", "ma"))

Value

A numeric vector

Arguments

u

an error vector

listw

a listw object generated with sim_grid_listw().

lambda

a value value between -1 and 1. The spatial autoregressive coefficient for the error term.

model

default "sar". Which model should be simulated. Provide "ma" for the moving average.

References

See spreg.dgp.dgp_errproc

Examples

Run this code
listw <- sim_grid_listw(5) 
u <- make_error(25)
sim_error(u, listw)

Run the code above in your browser using DataLab