Learn R Programming

R2BayesX (version 1.1-5)

write.bayesx.input: Write the BayesX Program

Description

Function write.bayesx.input takes an object from parse.bayesx.input and translates the input to an executable program file which may be send to the BayesX binary.

Usage

write.bayesx.input(object)

Value

Function returns a list containing a character string with all commands used within the executable of BayesX, the program name, model name and the file directory where the program file is stored.

Arguments

object

An object of class "bayesx.input", see parse.bayesx.input

Author

Nikolaus Umlauf, Thomas Kneib, Stefan Lang, Achim Zeileis.

Details

This function translates the model specified in the formula within parse.bayesx.input or bayesx into a BayesX executable program file, secondly the function writes a data file into the specified directory chosen in bayesx.control, parse.bayesx.input or bayesx, where BayesX will find the necessary variables for estimation.

Examples

Run this code
## generate some data
set.seed(111)
n <- 500

## regressors
dat <- data.frame(x = runif(n, -3, 3), z = runif(n, -3, 3),
   w = runif(n, 0, 6), fac = factor(rep(1:10, n/10)))

## response
dat$y <- with(dat, 1.5 + sin(x) + cos(z) * sin(w) +
   c(2.67, 5, 6, 3, 4, 2, 6, 7, 9, 7.5)[fac] + rnorm(n, sd = 0.6))

## create BayesX .prg
pars <- parse.bayesx.input(y ~ sx(x) + sx(z, w, bs = "te") + fac,
  data = dat)
prg <- write.bayesx.input(pars)
print(prg)

## have a look at the generated files
## which are used within BayesX
print(list.files(paste(tempdir(), "/bayesx", sep = "")))

Run the code above in your browser using DataLab