https://github.com/cran/ensembleBMA
Raw File
Tip revision: 95cce576eb46ce512c1355769cfdafd8c2af4b02 authored by Chris Fraley on 25 December 2011, 00:00:00 UTC
version 5.0.3
Tip revision: 95cce57
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