Learn R Programming

nlsr (version 2019.9.7)

rjfundoc: Document functions that evaluate residuals at particular parameter locations.

Description

Output a description of the model and the data that was used at the time of its creation to the console and optionally to a file. The purpose of this function is to provide a record of the details underlying the function fun as well as to aid users wishing to create objective functions for optimization tools.

Usage

rjfundoc(fun, savefile=NULL)
# S3 method for rjfundoc
print(x, ...)

Arguments

fun

A function produced by model2rjfun.

savefile

A character string or connection giving a location in which to record the rjfundoc output.

x, ...

Object to print, and other arguments that will be ignored.

Value

rjfundoc returns a list of class "rjfundoc" containing values extracted from the environment of fun.

Details

rjfundoc displays the contents of the environment associated with fun.

See Also

nls

Examples

Run this code
# NOT RUN {
## require(nlsr)
traceval  <-  TRUE  # traceval set TRUE to debug or give full history
# Data for Hobbs problem
ydat  <-  c(5.308, 7.24, 9.638, 12.866, 17.069, 23.192, 31.443, 
          38.558, 50.156, 62.948, 75.995, 91.972) # for testing
tdat  <-  seq_along(ydat) # for testing
# A simple starting vector -- must have named parameters for nlxb, nls, wrapnlsr.
start1  <-  c(b1=1, b2=1, b3=1)
weeddata2  <-  data.frame(y=1.5*ydat, tt=tdat)
escal <-  y ~ ms*b1/(1+b2*exp(-b3*tt))
ms <- 1
weeddata3<-weeddata2
weeddata3$y<-0
grs3<-model2rjfun(escal, start1, data=weeddata3, ms=ms)
res3<-grs3(start1)
res3
rjfundoc(grs3)

# Now a different value of ms
ms<-2
grs3b<-model2rjfun(escal, start1, data=weeddata3, ms=ms)
res3b<-grs3b(start1)
res3b
rjfundoc(grs3b)
# rjfundoc(grs3b, savefile="grs3save.txt") ## to save the output

# }

Run the code above in your browser using DataLab