prediction: Predictions for parameterized models on new variable states

Description Usage Arguments Examples

Description

Given a fitted model, predict future timepoints starting from given starting points or random starting points. Compare prediction with test data from the inference result object. Only for result assessment.

Usage

1
prediction(result, data)

Arguments

result
data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (result, data) 
{
    x0 <- data$testData[1, -1]
    pred <- solveLV_bio(result$Parms, data$testData[1:nrow(data$testData), 
        1], x0)
    Coef_of_determination <- R_squared(pred, data$testData)
    result$R_squared_test_Data <- Coef_of_determination
    r <- c()
    for (i in 1:10) {
        x0 <- runif(n = data$species, 0, 1)
        new <- solveLV_bio(data$Parms, times = 0:50, States = x0)
        pred2 <- solveLV_bio(result$Parms, new[, 1], x0)
        r[i] <- R_squared(pred2, new)
    }
    result$R_squared_new_Data <- mean(r)
    return(result)
  }

lkshrsch/gLVInterNetworks documentation built on May 21, 2019, 7:33 a.m.