parlist: Parameter list

Description Usage Arguments Author(s) See Also Examples

View source: R/classes.R

Description

The special use of a parameter list is to save the outcome of multiple optimization runs provided by mstrust, into one list.

Fitlists carry an fit index which must be held unique on merging multiple fitlists.

Usage

1
2
3
4
5
6
7
8
9
parlist(...)

as.parlist(x = NULL)

## S3 method for class 'parlist'
summary(object, ...)

## S3 method for class 'parlist'
c(...)

Arguments

...

Objects to be coerced to parameter list.

x

list of lists, as returned by trust

object

a parlist

Author(s)

Wolfgang Mader, Wolfgang.Mader@fdm.uni-freiburg.de

See Also

load.parlist, plot.parlist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Generate a prediction function
regfn <- c(y = "sin(a*time)")

g <- Y(regfn, parameters = "a")
x <- Xt(condition = "C1")

## Generate data
data <- datalist(
  C1 = data.frame(
    name = "y",
    time = 1:5,
    value = sin(1:5) + rnorm(5, 0, .1),
    sigma = .1
  )
)

## Initialize parameters and time 
pars <- c(a = 1)
times <- seq(0, 5, .1)

plot((g*x)(times, pars), data)

## Do many fits from random positions and store them into parlist
out <- as.parlist(lapply(1:50, function(i) {
  trust(normL2(data, g*x), pars + rnorm(length(pars), 0, 1), rinit = 1, rmax = 10)
}))

summary(out)

## Reduce parlist to parframe
parframe <- as.parframe(out)
plotValues(parframe)

## Reduce parframe to best fit
bestfit <- as.parvec(parframe)
plot((g*x)(times, bestfit), data)

dMod documentation built on Jan. 27, 2021, 1:07 a.m.