write.bayesx.input: Write the BayesX Program

Description Usage Arguments Details Value Author(s) Examples

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

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## 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 = "")))

datacamp/R2BayesX documentation built on May 14, 2019, 7:10 p.m.