View source: R/write.bayesx.input.R
write.bayesx.input | R Documentation |
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.
write.bayesx.input(object)
object |
An object of class |
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.
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.
Nikolaus Umlauf, Thomas Kneib, Stefan Lang, Achim Zeileis.
## 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 = "")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.