Message-ID: <4ED4C9B1.8020007@email.uni-kiel.de>
Date: 2011-11-29T12:01:53Z
From: Christof Kluß
Subject: simplify source code
In-Reply-To: <CADv2QyHj_dSmiKrC6jsUxPZdcq8=QN6wAAfW_ihN9tQjt3AijA@mail.gmail.com>
Hi Dennis,
thank you very much. That works fine.
Is there a possibility that R continue even if one of the models is not
solvable? R currently terminates with an error message.
greetings
Christof
Am 27-11-2011 01:34, schrieb Dennis Murphy:
> vars<- c('y1', 'y2', 'y3')
>
> # Function to create the model formula by plugging in the
> # response y and run the model
> mfun<- function(y) {
> form<- as.formula(paste(y, 'cbind(1, exp(x/th))', sep = ' ~ '))
> nls(form, data = dg, start = list(th = 0.3), algorithm = 'plinear')
> }
>
> # Generate a list of model objects:
> mlist<- lapply(vars, mfun)