Generate simulated data from spaital covariate-augmented Poisson factor models

gendata_spacoap(
  seed = 1,
  width = 20,
  height = 30,
  p = 500,
  d = 40,
  k = 3,
  q = 5,
  rank0 = 3,
  eta0 = 0.5,
  bandwidth = 1,
  rho = c(10, 1),
  sigma2_eps = 1,
  seed.beta = 1
)

Arguments

seed

a postive integer, the random seed for reproducibility of data generation process.

width

a postive integer, specify the width of the spatial grid.

height

a postive integer, specify the height of the spatial grid.

p

a postive integer, specify the dimension of count variables.

d

a postive integer, specify the dimension of covariate matrix with low-rank regression coefficient matrix.

q

a postive integer, specify the number of factors.

rank0

a postive integer, specify the rank of the coefficient matrix.

eta0

a real between 0 and 1, specify the spatial autocorrelation parameter.

rho

a numeric vector with length 2 and positive elements, specify the signal strength of loading matrix and regression coefficient, respectively.

sigma2_eps

a positive real, the variance of overdispersion error.

seed.beta

a postive integer, the random seed for reproducibility of data generation process by fixing the regression coefficient matrix beta.

r

a postive integer, specify the dimension of covariate matrix as control variables.

Value

return a list including the following components:

  • X - the high-dimensional count matrix;

  • Z - the low-dimensional covariate matrix with control variables.

  • H - the high-dimensional covariate matrix;

  • Adj_sp - the weighted adjacence matrix;

  • alpha0 - the regression coefficient matrix corresponing to Z;

  • bbeta0 - the low-rank large regression coefficient matrix corresponing to H;

  • B0 - the loading matrix;

  • F0 - the laten factor matrix;

  • rank0 - the true rank of bbeta0;

  • q - the true number of factors;

  • eta0 - spatial autocorrelation parameter;

  • pos - spatial coordinates for each observation.

Details

None

References

None

See also

Examples

width <- 20; height <- 15; p <- 100
d <- 20; k <- 3; q <- 6; r <- 3
datlist <- gendata_spacoap(width=width, height=height, p=p, d=20, k=k, q=q, rank0=r)
str(datlist)
#> List of 12
#>  $ X     : num [1:300, 1:100] 0 18 0 0 1 0 0 1 21 10 ...
#>  $ Z     : num [1:300, 1:3] 1 1 1 1 1 1 1 1 1 1 ...
#>  $ H     : num [1:300, 1:20] 0.3049 0.0964 0.1098 0.3918 0.2063 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : NULL
#>   .. ..$ : NULL
#>  $ Adj_sp:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
#>   .. ..@ i       : int [1:1130] 1 15 0 2 16 1 3 17 2 4 ...
#>   .. ..@ p       : int [1:301] 0 2 5 8 11 14 17 20 23 26 ...
#>   .. ..@ Dim     : int [1:2] 300 300
#>   .. ..@ Dimnames:List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : NULL
#>   .. ..@ x       : num [1:1130] 0.368 0.368 0.368 0.368 0.368 ...
#>   .. ..@ factors : list()
#>  $ alpha0: num [1:100, 1:3] -0.626 0.184 -0.836 1.595 0.33 ...
#>  $ bbeta0: num [1:100, 1:20] -1.068 -0.153 0.926 -1.521 -1.689 ...
#>  $ B0    : num [1:100, 1:6] 0.722 2.129 -1.839 -2.117 -3.864 ...
#>  $ F0    : num [1:300, 1:6] -0.67448 0.00422 -0.86201 1.48901 0.60974 ...
#>  $ rank  : num 3
#>  $ q     : num 6
#>  $ eta0  : num 0.5
#>  $ pos   : int [1:300, 1:2] 1 1 1 1 1 1 1 1 1 1 ...