Learn R Programming

bbl (version 0.1.5)

sample_xi: Generate Random Samples from BB model

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.

Value

Data frame of samples in rows and predictors in columns.

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.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab