Xd: Model prediction function from data.frame

View source: R/prediction.R

XdR Documentation

Model prediction function from data.frame

Description

Model prediction function from data.frame

Usage

Xd(data, condition = NULL)

Arguments

data

data.frame with columns "name", "time", and row names that are taken as parameter names. The data frame can contain a column "value" to initialize the parameters.

condition

either NULL (generic prediction for any condition) or a character, denoting the condition for which the function makes a prediction.

Value

Object of class prdfn, i.e. a function x(times pars, deriv = TRUE, conditions = NULL), see also Xs. Attributes are "parameters", the parameter names (row names of the data frame), and possibly "pouter", a named numeric vector which is generated from data$value.

Examples

# Generate a data.frame and corresponding prediction function
timesD <- seq(0, 2*pi, 0.5)
mydata <- data.frame(name = "A", time = timesD, value = sin(timesD), 
                     row.names = paste0("par", 1:length(timesD)))
x <- Xd(mydata)

# Evaluate the prediction function at different time points
times <- seq(0, 2*pi, 0.01)
pouter <- structure(mydata$value, names = rownames(mydata))
prediction <- x(times, pouter)
plot(prediction)


dkaschek/dMod documentation built on July 27, 2023, 11:45 p.m.