I haven't seen a reply to this question, so I will attempt a few remarks in spite of some confusion about what you are asking. 1. The function to use for parameter estimation depends on ths structure of the data. My all-around preference for many purposes is for "optim", but I've used "nls", "fitdistr" (in the MASS package) and others in different circumstances. 2. If you are doing nonlinear estimation with, e.g., optim, I suggest you request "hessian=TRUE". The eigenvalues of the hessian will tell you if it is ill conditioned. If it is, you might consider reparameterizing the model. 3. I try to avoid using reserved words like "c". R can often determine what you want from the context, but there are exceptions. I try to avoid that problem by testing a name at a command prompt before I use it. If it returns, "object not found", I'm fine; if not, I try something different. 4. Following the posting guide! "http://www.R-project.org/posting-guide.html" can on average increase the likelihood that you will receive helpful suggestions quickly. (I've learned that people rarely respond to my incoherent screams; when they do, it's rarely helpful. I've reluctantly learned that there is often no substutute for reading the *#@%* manual.) I'd be shocked if this answered your question, but I hope it is helpful nonetheless. spencer graves
ppancoska at notes.cc.sunysb.edu wrote:
Hi, I am sorry for this question, but I am trying to speed up an
application....
I will need to fit many x-y data sets (input from text files) to
4-parameter Pseudo-Voigt peak function.
Until now I used SigmaPlot macro to do it (enclosed just in case...)
peaksign(q) = if(total(q)>q[1], 1, -1)
xatymin(q,r) = xatymax(q,max(r)-r)
[Parameters]
a = if(peaksign(y)>0, max(y), min(y)) ''Auto {{previous: 60.8286}}
b = fwhm(x,abs(y))/2 ''Auto {{previous: 0.656637}}
c = .5 ''Auto {{previous: 6.82973e-010}}
x0 = if(peaksign(y)>0, xatymax(x,y), xatymin(x,y)) ''Auto {{previous:
3.19308}}
[Equation]
f = a*(c*(1/(1+((x-x0)/b)^2))+(1-c)*exp(-0.5*((x-x0)/b)^2))
fit f to y
(manageable for ~100), but it looks like the next project would need to
process ~1000 member sets.
I am not as familiar with R to find the right info (although I can use R in
general).
I am also nearly sure that there should be a solution to this task "out
there" ready to be modified...
Could you be so kind and direct me please to the right package or web-site
with examples?
Thank you very much
Dr. Petr Pancoska
Department of Pathology
SUNY Stony Brook, NY 11794
phone: (631)-444-3030
******************************************************************************
This e- mail message, including any attachments,
is for the sole use of the intended recipient(s) and may
contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender
by e-mail and destroy all copies of the original.
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA spencer.graves at pdf.com www.pdf.com <http://www.pdf.com> Tel: 408-938-4420 Fax: 408-280-7915