Description Usage Arguments Details Value

A reference class object that contains a Bayesian Additive Regression Trees sampler in such a way that it can be modified, stopped, and started all while maintaining its own state.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ```
## S4 method for signature 'dbartsSampler'
run(numBurnIn, numSamples, updateState = NA)
## S4 method for signature 'dbartsSampler'
sampleTreesFromPrior(updateState = NA)
## S4 method for signature 'dbartsSampler'
copy(shallow = FALSE)
## S4 method for signature 'dbartsSampler'
show()
## S4 method for signature 'dbartsSampler'
predict(x.test, offset.test)
## S4 method for signature 'dbartsSampler'
setControl(control)
## S4 method for signature 'dbartsSampler'
setModel(model)
## S4 method for signature 'dbartsSampler'
setData(data)
## S4 method for signature 'dbartsSampler'
setResponse(y, updateState = NA)
## S4 method for signature 'dbartsSampler'
setOffset(offset, updateState = NA)
## S4 method for signature 'dbartsSampler'
setPredictor(x, column, updateState = NA)
## S4 method for signature 'dbartsSampler'
setTestPredictor(x.test, column, updateState = NA)
## S4 method for signature 'dbartsSampler'
setTestPredictorAndOffset(x.test, offset.test, updateState = NA)
## S4 method for signature 'dbartsSampler'
setTestOffset(offset.test, updateState = NA)
## S4 method for signature 'dbartsSampler'
printTrees(treeNums)
## S4 method for signature 'dbartsSampler'
plotTree(treeNum, treePlotPars = list(nodeHeight = 12, nodeWidth = 40, nodeGap = 8), ...)
``` |

`numBurnIn` |
A non-negative integer determining how many iterations the sampler should
skip before storing results. If missing or |

`numSamples` |
A positive integer determining how many posterior samples should be
returned. If missing or |

`updateState` |
A logical determining if the local cache of the sampler's state
should be updated after the completion of the run. If |

`shallow` |
A logical determining if the copy should retain the underlying data of the sampler
( |

`control` |
An object inheriting from |

`model` |
An object inheriting from |

`data` |
An object inheriting from |

`y` |
A numeric response vector of length equal to that with which the sampler was created. |

`x` |
A numeric predictor vector of length equal to that with which the sampler was created. Can be
an entirely matrix of new number of rows for |

`x.test` |
A new matrix of test predictors, of the number of columns equal to that in the current model. |

`offset` |
A numeric vector of length equal to that with which the sampler was created, or |

`offset.test` |
A numeric vector of length equal to that of the test matrix, or |

`column` |
An integer or character string vector specifying which column/columns of the predictor matrix is to be replaced. If missing, the entire matrix is substitude. |

`treeNums` |
An integer vector listing the indices of the trees to print. |

`treeNum` |
An integer listing the indices of the tree to plot. |

`treePlotPars` |
A list containing the number quantities |

`...` |
Extra arguments to |

A `dbartsSampler`

is a “mutable” object which contains information pertaining to
fitting a Bayesian additive regression tree model. The sampler is first created and then,
in a separate instruction, run or modified. In this way, MCMC samplers can be constructed
with BART components filling arbitrary roles.

`save`

ing and `load`

ing a `dbarts`

sampler for future use
requires that R's serialization mechanism be able to access the state of the sampler
which, for memory purposes, is only made available to R on request. To do this, one must
“touch” the sampler's state object before saving, e.g. for the object `sampler`

,
execute `invisible(sampler$state)`

. This is in addition to guaranteeing that the
`state`

object is not `NULL`

, which can be done by setting the sampler's control
to an object with `updateState`

as `TRUE`

or passing `TRUE`

as the
`updateState`

argument to any of the sampler's applicable methods.

For `run`

, a named-list with contents `sigma`

, `train`

, `test`

, and `varcount`

.

For `setPredictor`

, `TRUE`

/`FALSE`

depending on whether or not the operation was successful.
The operation can fail if the new predictor results in a tree with an empty leaf-node. If only single columns
were replaced, on the update is rolled-back so that the sampler remains in a valid state.

`predict`

keeps the current test matrix in place and uses the current set of tree splits.
It is intended that this function only be used when the `runMode`

of `dbartsControl`

is
`"fixedSamples"`

, since otherwise only a single set of trees are stored.

vdorie/dbarts documentation built on Dec. 18, 2018, 2:31 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.