MoTBFs (version 1.2)

learnMoTBFpriorInformation: Incorporating Prior Knowledge

Description

Learns a function using prior information.

Usage

learnMoTBFpriorInformation(
  priorData,
  data,
  s,
  POTENTIAL_TYPE,
  domain = range(data),
  coeffversion = 4,
  restrictDomain = TRUE,
  maxParam = NULL
)

Arguments

priorData

A "numeric" array which contains the values of the variable we have information apriori about.

data

A "numeric" array which contains the values to fit.

s

A "numeric" coefficient which fixes the confidence of the prior knowledge we are going to introduce. By default it is NULL, only we must modify it if we want to incorporate prior information to the fits.

POTENTIAL_TYPE

A "character" string specifying the posibles potential types, must be one of "MOP" or "MTE".

domain

A "numeric" array which contains the limits to defined the data function. By default it is the range of the data.

coeffversion

A "numeric" value between 1--4 which contains the used version for computing the coefficients of the linear opinion pool to combine the prior function and the data function. By default coeffversion = "4" is used, so the combination depends on the goodness of the model versus another random model.

restrictDomain

This argument lets us choose if the domain is used joining both domains, the prior one and the data domain or trimming them. By default TRUE is used, so the domain will be trimmed.

maxParam

A "numeric" value which indicates the maximum number of coefficients in the function. By default it is NULL; if not, the output is the function which gets the best BIC with at most this number of parameters.

Value

A list with the elements

coeffs

An "numeric" array with the two coefficients of the linear opinion pool

posteriorFunction

The final function after combining.

priorFunction

The fit of the prior data.

dataFunction

The fit of the original data.

rangeNewPriorData

A "numeric" vector which contains the final domain where the functions are defined.

See Also

getCoefficients

Examples

Run this code
# NOT RUN {
## Data
X <- rnorm(15)

## Prior Data
priordata <- rnorm(5000)

## Test data
test <- rnorm(1000)
testData <- test[test>=min(X)&test<=max(X)]

## Learning
type <- "MOP" 
confident <- 3 ## confident <- 1,2,...,length(X)
f <- learnMoTBFpriorInformation(priorData = priordata, data = X, s = confident,
POTENTIAL_TYPE = type)
attributes(f)

## Log-likelihood
sum(log(as.function(f$dataFunction)(testData)))
sum(log(as.function(f$posteriorFunction)(testData))) ## best loglikelihood


# }

Run the code above in your browser using DataLab