https://github.com/cran/ensembleBMA
Raw File
Tip revision: f5ae722309f273a5b3e5fae294b71d73501cec72 authored by Chris Fraley on 15 July 2013, 00:00:00 UTC
version 5.0.4
Tip revision: f5ae722
fitBMA.R
`fitBMA` <-
function(ensembleData, control = NULL, model = NULL, 
         exchangeable = NULL)
{
#
# copyright 2006-present, University of Washington. All rights reserved.
# for terms of use, see the LICENSE file
#
 if (!inherits(ensembleData,"ensembleData")) stop("not an ensembleData object")
 mc <- match.call()   
 mc$model <- NULL

 if (!is.null(model)) {
   MODELS <- c("normal","gamma0")
   m <- pmatch( model, MODELS, nomatch=0)
   model <- if (m) MODELS[m] else "?"
 }
 else stop("unspecified model")

 switch( model,
        "normal" = {
             mc[[1]] <- as.name("fitBMAnormal")
          },
        "gamma0" = {
             mc[[1]] <- as.name("fitBMAgamma0")
         },
       stop("unrecognized model")
    )

 if (length(attr(ensembleData, "class")) > 2) {
   attr(ensembleData, "class") <- attr(ensembleData, "class")[-1]
   mc$ensembleData <- ensembleData
 }

 eval(mc, parent.frame())
}

back to top