Learn R Programming

ernm (version 1.0.4)

createCppModel: Creates a C++ representation of an ERNM model

Description

Creates a C++ representation of an ERNM model

Usage

createCppModel(
  formula,
  ignoreMnar = TRUE,
  cloneNet = TRUE,
  theta = NULL,
  modelArgs = list(modelClass = "Model")
)

Value

a Model object

Arguments

formula

the model formula (see ernm-formula)

ignoreMnar

ignore missing not at random offsets

cloneNet

should the network be cloned

theta

the model parameters.

modelArgs

additional arguments for the model, e.g. tapering parameters

Examples

Run this code
if (FALSE) {
edge_list <- matrix(numeric(),ncol=2)
net <- new(UndirectedNet,edge_list,5)

rcpp_model <- createCppModel(net ~ edges(), theta = 0)

rcpp_sampler <- new(UndirectedMetropolisHastings, rcpp_model)

# Run MCMC to generate 30 networks with burnin=10 and an interval of 20 steps between each network
networks <- rcpp_sampler$generateSample(10,20,30)

sapply(networks, function(net) net$nEdges()) # number of edges in each network
}

Run the code above in your browser using DataLab