sample_xi {bbl}R Documentation

Generate Random Samples from Boltzmann Distribution

Description

Random samples are drawn from Boltzmann distribution

Usage

sample_xi(nsample = 1, predictors = NULL, h, J, code_out = FALSE)

Arguments

nsample

Sample size

predictors

List of predictor factor levels.

h

Bias parameter; see bbl.

J

Interaction parameters; see bbl.

code_out

Ouput in integer codes; a_i = 0, \cdots, L_i-1. If FALSE, output in factors in predictors.

Details

All possible factor states are enumerated exhaustively using input argument predictors. If the number of predictors m or the number of factor levels L_i for each predictor i are even moderately large (m\ge 10 or L_i\ge 5), this function will likely hang because the number of all possible states grows exponentially.

Value

Data frame of samples in rows and predictors in columns.

Examples

set.seed(512)
m <- 5
n <- 1000
predictors <- list()
for(i in 1:m) predictors[[i]] <- c('a','c','g','t')
par <- randompar(predictors)
xi <- sample_xi(nsample=n, predictors=predictors, h=par$h, J=par$J)
head(xi)

[Package bbl version 1.0.0 Index]