View source: R/query-functions.R
fetchBoth | R Documentation |
Combined results from calling estimateModel
followed
by predictModel
, estimateCounts
followed
by predictCounts
, or estimateAccount
followed by predictAccount
. (Note - functions
predictCounts, estimateAccount, and predictAccount have not been
written yet.)
fetchBoth(filenameEst, filenamePred, where, iterations = NULL, impute = TRUE)
filenameEst |
The filename used for estimation. |
filenamePred |
The filename used for prediction. |
where |
A character vector describing the path to the item to be extracted. |
iterations |
A vector of positive integers giving the iterations to be extracted if an item has multiple iterations. |
impute |
Logical. Whether to impute missing values.
Defaults to |
Identical results can be obtained by calling fetch
separately on the files created by the estimation and prediction functions,
and then combining. However, fetchBoth
is more convenient.
fetchBoth
is particularly convenient in the case of main effects,
since it normalises the combines the estimates and predictions before
normalising, rather than normalising each separately. (See the
documentation for fetch
for a discussion of normalisation.)
Function fetch
extracts results from a single file.
## Not run:
deaths <- demdata::us.deaths
exposure <- demdata::us.exposure
deaths <- Counts(deaths,
dimscales = c(year = "Intervals"))
exposure <- Counts(exposure,
dimscales = c(year = "Intervals"))
filename.est <- tempfile()
filename.pred <- tempfile()
model <- Model(y ~ Poisson(mean ~ age + sex + year))
estimateModel(model,
filename = filename.est,
y = deaths,
exposure = exposure,
nBurnin = 5,
nSim = 5,
nChain = 2,
parallel = FALSE)
predictModel(filenameEst = filename.est,
filenamePred = filename.pred,
n = 5)
## the model is too simple, and hasn't been run for long
## enough, but we'll extract some results anyway...
rate <- fetchBoth(filenameEst = filename.est,
filenamePred = filename.pred,
where = c("model", "likelihood", "rate"))
year <- fetchBoth(filenameEst = filename.est,
filenamePred = filename.pred,
where = c("model", "prior", "year"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.