Description Usage Arguments Value Examples
Generates data from the autologistic and automultinomial models via Gibbs sampling. See the vignette for an example of use.
1 | drawSamples(beta, gamma, X, A, burnIn = 300, nSamples, y = NULL)
|
beta |
coefficient vector (for the autologistic model) or matrix (for the automultinomial model) |
gamma |
the value of the autocorrelation parameter |
X |
the design matrix |
A |
the (square symmetric) adjacency matrix encoding the neighborhood structure |
burnIn |
the number of burnin samples to be used. Defaults to 300 |
nSamples |
the number of samples to draw |
y |
optional starting configuration, in factor form. Defaults to NULL |
simulated samples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ##########generating coefficient values and data
#adjacency matrix A
A=igraph::get.adjacency(igraph::make_lattice(c(40,40)))
#design matrix
X=cbind(rep(1,1600),matrix(rnorm(1600*4),ncol=4))
#correlation parameter
gamma=0.6
#2 response categories (1 column in coefficient matrix)
beta2=matrix(rnorm(5)*0.3,ncol=1)
#This example uses a short burnIn period. Use a longer burnIn in practice.
y2=drawSamples(beta2,gamma,X,A,burnIn=1,nSamples=1)
#3 response categories (2 columns in coefficient matrix)
beta3=matrix(rnorm(10)*0.3,ncol=2)
y3=drawSamples(beta3,gamma,X,A,burnIn=1,nSamples=1)
##########
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.