#################################################################################
Readme file for the Matlab code of 
“Identifying Functional Co-activation Patterns in Neuroimaging Studies via Poisson Graphical Models”
Author: Wenqiong Xue, Jian Kang, F.DuBois Bowman,Tor D. Wager and Jian Guo

#################################################################################
The source code can be downloaded from the following URL

http://web1.sph.emory.edu/users/jkang30/software/PoissonGraph.html

#################################################################################


The source code includes the following m files of Matlab functions:

1. EM_PoissonGraph.m: 

This function uses the EM algorithm to find the point estimates of the intensity parameters for the Poisson Graphical Model.

Input Arguments
 -- X: p by n matrix represents the graphical model, where p is the number
      of nodes in the graph and n is the sample size
 -- theta: scalar of nonnegative number represents the peanalized
          paramters
 -- showstep: binary indictor (0/1) indicates that whether show the traces
          of the iterative steps. The default value is 1.

Output Values:
 -- lambda_est: p by p matrix contains the estimates of intensity
                paramters
 -- lambda_iter: p by p by m array contains the trace of estimates over
                iterations, where m is the number of iteratoins


2. EM_PoissonGraph_Bootstrap.m: 

This function uses bootstrap to find make inference (estimating the standard errors and confidence intervals of the estimates) on the intensity parameters for the Poisson Graphical Model.


Input Arguments
 -- X: p by n matrix represents the graphical model, where p is the number
      of nodes in the graph and n is the sample size
 -- theta: scalar of nonnegative number represents the peanalized
          paramters
 -- nboot: number of bootstraps that are used to make inference
 -- showstep: binary indictor (0/1) indicates that whether show the traces
          of the iterative steps. The default value is 1.

Output Values:
 -- lambda_sd: p by p matrix contains the standard deviation of the 
              estimates of intensity paramters
 -- lambda_lcl: p by p matrix contains the lower bound the 95% CI of the 
              estimates of intensity paramters
 -- lambda_ucl: p by p matrix contains the upper bound the 95% CI of the 
              estimates of intensity paramters

3. simulate_data.m: 

This function simulates multivariate Poisson data.

Input arguments:
 --lambda: p by p matrix represents the intensity parameters
 --n: integer scalar represents the sample size

Output values:
 --X: p by n matrix with each row representing a sample of multivariate 
      Poisson data
 --Y: p by p by n array represents the latent independent Poisson
      Variables that generate the X


4. pre_compute_A.m: 

This function computes the log factorials that are potentially involved in the computation of log-likelihood function. 

Input Arguments
 -- max_X: integer scalar representing the maximum value of the observed 
           Poisson data
Output Value
 -- A: max_X by max_X by max_X array contains the log factorials




Example implementation:
‘script_run.m’

1. This script demonstrates how to use the software to fit the Poisson Graphical Model

2. It includes three steps: 1)simulate data, 2)fit the Poisson Graphical Model and 3)Make statistical inference on the Poisson Graphical Model



