write.bayesx.input: Write the BayesX Program

View source: R/write.bayesx.input.R

write.bayesx.inputR Documentation

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)

Arguments

object

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

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.

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.

Author(s)

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

Examples

## 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 = "")))

R2BayesX documentation built on Oct. 20, 2023, 9:11 a.m.