sample_xi: Generate Random Samples from Boltzmann Distribution

Description Usage Arguments Details Value Examples

View source: R/sample.R

Description

Random samples are drawn from Boltzmann distribution

Usage

1
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≥ 10 or L_i≥ 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

1
2
3
4
5
6
7
8
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)

bbl documentation built on Jan. 28, 2022, 1:07 a.m.