Learn R Programming

scrime (version 1.3.5)

predictFBLR: Predict Case Probabilities with Full Bayesian Logic Regression

Description

Predicts case probabilities for binary data (usually SNP data dichotomized with snp2bin) based on an MCMC sample of Bayesian logic regression models obtained with fblr.

Usage

predictFBLR(file, bin, kmax = 10, int.level = 2)

Arguments

file

character string naming file where MCMC sample is stored.

bin

matrix of binary variables to make predictions for. One row is one observation. The number of binary variables has to be the same as used in fblr.

kmax

the maximum number of allowed logic predictors used in fblr.

int.level

the maximum number of allowed binaries in a logic predictor used in fblr.

Value

Vector of length nrow(bin) with predicted case probabilities.

See Also

fblr

Examples

Run this code
# NOT RUN {
# Use fblr on some simulated SNP data
snp <- matrix(rbinom(500 * 20, 2, 0.3), ncol = 20)
bin <- snp2bin(snp)
int <- apply(bin,1,function(x) (x[1] == 1 & x[3] == 0)*1)
case.prob <- exp(-0.5+log(5)*int)/(1+exp(-0.5+log(5)*int))
y <- rbinom(nrow(snp),1,prob=case.prob)
fblr(y, bin, niter=1000, nburn=0)

# Prediction for some new observations 
newbin <- snp2bin(matrix(rbinom(100 * 20, 2, 0.3), ncol = 20))
predictFBLR("fblr_mcmc.txt",newbin)

# }

Run the code above in your browser using DataLab