simu_multiscale | R Documentation |
The simu_multiscale function is designed for simulating a spatially varying coefficient DGP (Data Generating Process) based on formulations proposed by Fotheringam et al. (2017), Gao et al. (2021), or Geniaux (2024).
simu_multiscale(n=1000,myseed=1,type='GG2024',constant=NULL,
nuls=NULL,config_beta='default',config_snr=0.7,config_eps='normal',
ratiotime=1)
n |
An integer number of observations |
myseed |
An integer seed used for the simulation. |
type |
Type of DGP used 'FT2017', 'Gao2021' or 'GG2024', default 'GG2024'. |
constant |
A boolean parameter indicating whether the intercept term should be spatially varying (TRUE) or not (FALSE). |
nuls |
A vector of null parameters, default NULL |
config_beta |
name of the type of spatial pattern of Beta coefficients |
config_snr |
a value of signal noise ratio |
config_eps |
name of the distribution of error ('normal','unif' or 'Chi2') |
ratiotime |
multiplicating factor, for spacetime DGP. |
A named list with simulated data ('mydata') and coords ('coords')
library(mgwrsar)
library(ggplot2)
library(gridExtra)
library(grid)
simu=simu_multiscale(1000)
mydata=simu$mydata
coords=simu$coords
p1<-ggplot(mydata,aes(x,y,col=Beta1))+geom_point() +scale_color_viridis_c()
p2<-ggplot(mydata,aes(x,y,col=Beta2))+geom_point() +scale_color_viridis_c()
p3<-ggplot(mydata,aes(x,y,col=Beta3))+geom_point() +scale_color_viridis_c()
p4<-ggplot(mydata,aes(x,y,col=Beta4))+geom_point() +scale_color_viridis_c()
grid.arrange(p1,p2,p3,p4,nrow=2,ncol=2, top = textGrob("DGP Geniaux (2024)"
,gp=gpar(fontsize=20,font=3)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.