SpaCOAP {SpaCOAP}R Documentation

Fit the SpaCOAP model

Description

Fit the spatial covariate-augmented overdispersed Poisson factor model

Usage

SpaCOAP(
  X_count,
  Adj_sp,
  H,
  Z = matrix(1, nrow(X_count), 1),
  offset = rep(0, nrow(X_count)),
  rank_use = 5,
  q = 15,
  epsELBO = 1e-08,
  maxIter = 30,
  verbose = TRUE,
  add_IC_inter = FALSE,
  seed = 1,
  algo = 1
)

Arguments

X_count

a count matrix, the observed count matrix with shape n-by-p.

Adj_sp

a sparse matrix, the weighted adjacency matrix;

H

a n-by-d matrix, the covariate matrix with low-rank regression coefficient matrix;

Z

an optional matrix, the fixed-dimensional covariate matrix with control variables; default as a full-one column vector if there is no additional covariates.

offset

an optional vector, the offset for each unit; default as full-zero vector.

rank_use

an optional integer, specify the rank of the regression coefficient matrix; default as 5.

q

an optional string, specify the number of factors; default as 15.

epsELBO

an optional positive vlaue, tolerance of relative variation rate of the envidence lower bound value, defualt as '1e-8'.

maxIter

the maximum iteration of the VEM algorithm. The default is 30.

verbose

a logical value, whether output the information in iteration.

add_IC_inter

a logical value, add the identifiability condition in iterative algorithm or add it after algorithm converges; default as FALSE.

seed

an integer, set the random seed in initialization, default as 1;

algo

an optional integer taking value 1 0r 2, select the algorithm used, default as 1, representing variational EM algorithm.

Details

None

Value

return a list including the following components:

References

Liu W, Zhong Q. High-dimensional covariate-augmented overdispersed poisson factor model. Biometrics. 2024 Jun;80(2):ujae031.

See Also

None

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)
fitlist <- SpaCOAP(X_count=datlist$X, Adj_sp = datlist$Adj_sp, 
H= datlist$H, Z = datlist$Z, q=6, rank_use=3)
str(fitlist)

[Package SpaCOAP version 1.2 Index]