Description Usage Arguments Value Examples
View source: R/get_profile_function.R
Given previously calculated profile values by create.profile
, get.profile
merges the results together into a data frame.
1 2 | get.profile(which.par, range, homedir = getwd(), delete.old = FALSE,
save.it = TRUE)
|
which.par |
The names of the parameter that the profile should be returned for. |
range |
A numeric vector determining the values for which the profile should be calculated. Alternatively, setting it to "get.all" retrieves all available profile values and binds them together. |
homedir |
The directory in which the folder |
delete.old |
Logical. If TRUE, the individual point-wise fits created by |
save.it |
Logical. If TRUE (default), the gathered data will be bound and saved in the "Profile-Results/Tables/" folder. |
A data frame containing the negative log-likelihood and the fitted parameter values for a specific range created by create.profile
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #define cost function
cost_function <- function(parms){
y <- parms[1] + parms[2]*c(1:3) + parms[3]*sin(c(1:3))
LL <- sum((y - c(1:3))^2)
}
#create profile values
create.profile(which.par = "get.p1",
par.names = c(get.p1 = 1, get.p2 = 3, get.p3 = -2),
range = list(seq(0,5,1)),
fit.fn = cost_function,
future.off = TRUE)
#retrieve the calculated profile
res <- get.profile(which.par = "get.p1", range = seq(0,5,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.