Re: [R] Curve fitting

2020-04-05 Thread J C Nash
Generally nlsr package has better reliability in getting parameter estimates because it tries to use automatic derivatives rather than a rather poor numerical estimate, and also uses a Levenberg-Marquardt stabilization of the linearized model. However, nls() can sometimes be a bit more flexible.

Re: [R] Curve fitting

2020-04-05 Thread Bernard Comcast
Thanks Jeff Bernard Sent from my iPhone so please excuse the spelling!" > On Apr 5, 2020, at 3:14 PM, Jeff Newmiller wrote: > > stats::nlm? > >> On April 5, 2020 11:53:10 AM PDT, Bernard Comcast >> wrote: >> Any recommendations on an R package to fit data to a nonlinear model >> Y=f(x)

Re: [R] Curve fitting

2020-04-05 Thread Jeff Newmiller
err... stats::nls... On April 5, 2020 12:14:15 PM PDT, Jeff Newmiller wrote: >stats::nlm? > >On April 5, 2020 11:53:10 AM PDT, Bernard Comcast > wrote: >>Any recommendations on an R package to fit data to a nonlinear model >>Y=f(x) with a single x and y variable? >> >>I want to be able to

Re: [R] Curve fitting

2020-04-05 Thread Jeff Newmiller
stats::nlm? On April 5, 2020 11:53:10 AM PDT, Bernard Comcast wrote: >Any recommendations on an R package to fit data to a nonlinear model >Y=f(x) with a single x and y variable? > >I want to be able to generate parameter uncertainty estimates and >prediction uncertainties if possible. >

[R] Curve fitting

2020-04-05 Thread Bernard Comcast
Any recommendations on an R package to fit data to a nonlinear model Y=f(x) with a single x and y variable? I want to be able to generate parameter uncertainty estimates and prediction uncertainties if possible. Bernard Sent from my iPhone so please excuse the spelling!"

Re: [R] curve fitting an exponential function

2012-10-08 Thread giuseppe calamita
Hi Waltenegus, you should consider to show us your code and the data you used to fit the curve. If you can't or if you prefer you can simply show the code and some sample data on which the code can be run. You'll find nice and useful tool in nlstools package. Hope this help Giuseppe -

Re: [R] Curve fitting, probably splines

2012-04-16 Thread Simon Wood
You could use the summation convention built into mgcv:gam for this. See ?linear.functional.terms for details, but here is some example code, both for the exact match, you describe, and a noisy version. best, Simon library(mgcv) f2 - function(x) 0.2*x^11*(10*(1-x))^6+10*(10*x)^3*(1-x)^10 ##

Re: [R] Curve fitting, probably splines

2012-04-13 Thread Greg Snow
This sounds like possibly using logsplines may be what you want. See the 'oldlogspline' function in the 'logspline' package. On Thu, Apr 12, 2012 at 7:45 AM, Michael Haenlein haenl...@escpeurope.eu wrote: Dear all, This is probably more related to statistics than to [R] but I hope someone

[R] Curve fitting, probably splines

2012-04-12 Thread Michael Haenlein
Dear all, This is probably more related to statistics than to [R] but I hope someone can give me an idea how to solve it nevertheless: Assume I have a variable y that is a function of x: y=f(x). I know the average value of y for different intervals of x. For example, I know that in the

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-05-02 Thread Kyeong Soo (Joseph) Kim
- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Kyeong Soo (Joseph) Kim Sent: Friday, April 30, 2010 4:10 AM To: kMan Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations [snip] By the way, I

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-30 Thread Kyeong Soo (Joseph) Kim
] Sent: Tuesday, April 27, 2010 2:33 PM To: Gabor Grothendieck Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Frankly speaking, I am not looking for such a framework. The system I'm studying is a communication network (like M/M/1 queue, but way too

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-30 Thread Liaw, Andy
-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Frankly speaking, I am not looking for such a framework. The system I'm studying is a communication network (like M/M/1 queue, but way too complicated to mathematically analyze it using classical queueing

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-30 Thread kMan
. -Original Message- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Friday, April 30, 2010 4:10 AM To: kMan Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Dear Keith, Thanks for the suggestion and taking your time to respond

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-30 Thread Kyeong Soo (Joseph) Kim
-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Frankly speaking, I am not looking for such a framework. The system I'm studying is a communication network (like M/M/1 queue, but way too complicated to mathematically analyze it using classical

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-30 Thread Kyeong Soo (Joseph) Kim
30, 2010 4:10 AM To: kMan Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Dear Keith, Thanks for the suggestion and taking your time to respond to it. But, you misunderstand something and seems that you do not read all my previous e-mails

[R] Curve Fitting

2010-04-30 Thread Thomas Bschorr
I am having troubles in fitting functions of the form y~a*x^b+c to data, for example x-c(0.1,0.36,0.63,0.90,1.166,1.43, 1.70, 1.96, 2.23) y-c(8.09,9.0,9.62,10.11,10.53,10.9, 11.25, 11.56, 11.86) I tried for example with nls, which did only work with really good initial guessed values. Any

Re: [R] Curve Fitting

2010-04-30 Thread apjaworski
-help@r-project.org Date: 04/30/2010 03:33 PM Subject: [R] Curve Fitting Sent by: r-help-boun...@r-project.org I am having troubles in fitting functions of the form y~a*x^b+c to data, for example x-c(0.1,0.36,0.63,0.90,1.166,1.43, 1.70, 1.96, 2.23) y-c(8.09,9.0,9.62,10.11,10.53,10.9, 11.25

Re: [R] Curve Fitting

2010-04-30 Thread Gabor Grothendieck
You can use nls2 to try many starting values. It works just like nls but: - if you give it a two row data frame as the start value it will create a grid between the upper and lower values of each parameter and then run an optimization starting at each such point on the grid returning the best -

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-30 Thread Greg Snow
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Kyeong Soo (Joseph) Kim Sent: Friday, April 30, 2010 4:10 AM To: kMan Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations [snip

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-30 Thread Kyeong Soo (Joseph) Kim
-boun...@r- project.org] On Behalf Of Kyeong Soo (Joseph) Kim Sent: Friday, April 30, 2010 4:10 AM To: kMan Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations [snip] By the way, I wonder why most of the responses I've received from this list are so

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-30 Thread Greg Snow
Message- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Friday, April 30, 2010 5:24 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations I have already learned a lot from the list, both technical

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-29 Thread kMan
- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Tuesday, April 27, 2010 2:33 PM To: Gabor Grothendieck Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Frankly speaking, I am not looking for such a framework. The system I'm

[R] Curve Fitting/Regression with Multiple Observations

2010-04-27 Thread Kyeong Soo (Joseph) Kim
I recently came to realize the true power of R for statistical analysis -- mainly for post-processing of data from large-scale simulations -- and have been converting many of existing Python(SciPy) scripts to those based on R and/or Perl. In the middle of this conversion, I revisited the problem

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-27 Thread Bert Gunter
-project.org] On Behalf Of Kyeong Soo (Joseph) Kim Sent: Tuesday, April 27, 2010 10:31 AM To: r-help@r-project.org Subject: [R] Curve Fitting/Regression with Multiple Observations I recently came to realize the true power of R for statistical analysis -- mainly for post-processing of data from large

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-27 Thread Gabor Grothendieck
This will compute a loess curve and plot it: example(loess) plot(dist ~ speed, cars, pch = 20) lines(cars$speed, fitted(cars.lo)) Also this directly plots it but does not give you the values of the curve separately: library(lattice) xyplot(dist ~ speed, cars, type = c(p, smooth)) On Tue, Apr

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-27 Thread Kyeong Soo (Joseph) Kim
Hello Gabor, Many thanks for providing actual examples for the problem! In fact I know how to apply and generate plots using various R functions including loess, lowess, and smooth.spline procedures. My question, however, is whether applying those procedures directly on the data with multiple

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-27 Thread Gabor Grothendieck
If you are looking for a framework for statistical inference you could look at additive models as in the mgcv package which has a book associated with it if you need more info. e.g. library(mgcv) fm - gam(dist ~ s(speed), data = cars) summary(fm) plot(dist ~ speed, cars, pch = 20) fm.ci -

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-27 Thread Kyeong Soo (Joseph) Kim
Frankly speaking, I am not looking for such a framework. The system I'm studying is a communication network (like M/M/1 queue, but way too complicated to mathematically analyze it using classical queueing theory) and the conclusion I want to make is qualitative rather than quantatitive -- a

[R] curve fitting to data

2009-12-04 Thread Pascale Weber
Hi to all This is the first time I am quoting a question and I hope, my question is not too basic... For the following data, I wish to draw a fitted curve. x - c(123,129,141,144,144,145,149,150,158,159,163,174,183,187,242,248) y -

Re: [R] curve fitting to data

2009-12-04 Thread Gabor Grothendieck
A simple y vs log(x) fit seems to work pretty well here: fit - lm(y ~ log(x)) summary(fit) plot(y ~ log(x)) abline(fit) On Fri, Dec 4, 2009 at 9:06 AM, Pascale Weber pascale.we...@wsl.ch wrote: Hi to all This is the first time I am quoting a question and I hope, my question is not too

Re: [R] curve fitting to data

2009-12-04 Thread Peter Ehlers
Pascale, If you do want an nls fit with the associated error structure assumptions, check ?SSlogis. fm - nls(y ~ SSlogis(x, Asy, xmid, scal)) summary(fm) xx - seq(123, 248, length = 101) yy - predict(fm, list(x = xx)) plot(x, y) lines(xx, yy) -Peter Ehlers Gabor Grothendieck wrote: A

[R] curve fitting

2009-05-12 Thread Dmitry Gospodaryov
I have the data: for x: 2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74, for y: 100, 99, 99, 98, 97, 94, 82, 66, 48, 38, 22, 10, 1. y depends on x by equation: y = 100*exp(b*(1-exp(c*x))/c), where b and c are coefficients. I need to find coefficients in this equation for given data. How can I do

Re: [R] curve fitting

2009-05-12 Thread Jorge Ivan Velez
Dear Dmitry, Take a look at ?nls and its examples. HTH, Jorge On Tue, May 12, 2009 at 5:44 PM, Dmitry Gospodaryov gospodar...@rambler.ruwrote: I have the data: for x: 2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74, for y: 100, 99, 99, 98, 97, 94, 82, 66, 48, 38, 22, 10, 1. y depends on

Re: [R] curve fitting

2009-05-12 Thread Katharine Mullen
or use nls.lm as in install.packages(minpack.lm) library(minpack.lm) x - c(2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74) y - c(100, 99, 99, 98, 97, 94, 82, 66, 48, 38, 22, 10, 1) res - function(p, x, y) y - ff(p,x) ff - function(p, x) 100*exp(p[1]*(1-exp(p[2]*x))/p[2]) aa -

Re: [R] Curve fitting,FDA for biological data

2009-04-13 Thread trias
Hi Thanks a lot, I think you have covered the things I want to do for now so I will try to implement them as soon I can. A finite Fourier series could be the best tool IF the the multiple periodicities are all integer fractions of a common scale. This is certainly true for my repetitive

Re: [R] Curve fitting,FDA for biological data

2009-04-11 Thread spencerg
Dear Dr Gkikopoulos: 1. Have you looked at bioconductor.org? They have substantive extensions to R specifically for genomic data, which I assume would include chromosome. 2. To identify periodicities at different timescales, I agree with Stephen that spectrum would likely

Re: [R] Curve fitting,FDA for biological data

2009-04-06 Thread trias
There are a couple of different goals for this projects *identify periodicities at different timescales (ie different dT) *fit data into discrete number of curves, ie 6 different basic functions should be enough to describe the basic repeating elements in this data (ie 6 different categories

[R] Curve fitting,FDA for biological data

2009-04-03 Thread Triantafyllos Gkikopoulos
Dear all, Another newbie just got attracted to this mailing list. I am a biologist currently working my way through R, had sort play around with python earlier this year. I have some data exhibiting periodicity ** my data consists of peaks and valleys, with peaks arising due to the presence

Re: [R] Curve fitting,FDA for biological data

2009-04-03 Thread trias
Here is the gif that didn't come through earlier http://www.nabble.com/file/p22870832/signal.gif signal.gif -- View this message in context: http://www.nabble.com/Curve-fitting%2CFDA-for-biological-data-tp22868069p22870832.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Curve fitting,FDA for biological data

2009-04-03 Thread stephen sefick
What is your end goal? If it is to try and account for the variability of the timeseries you may want to look at ?spectrum If it is to model the periodicity... Stephen Sefick On Fri, Apr 3, 2009 at 11:30 AM, trias t.gkikopou...@dundee.ac.uk wrote: Here is the gif that didn't come through

[R] curve fitting with given term

2009-01-13 Thread gregor rolshausen
hello, I want to fit a curve to a simple x,y dataset - my problem is, that I want to fit it for the following term: n(1-e^x/y) - so I get the n constant for my data... can anyone help/comment on that? cheers, gregor __ R-help@r-project.org mailing

Re: [R] curve fitting with given term

2009-01-13 Thread Uwe Ligges
gregor rolshausen wrote: hello, I want to fit a curve to a simple x,y dataset - my problem is, that I want to fit it for the following term: n(1-e^x/y) - so I get the n constant for my data... Not an R problem in the first place, but the question arises what n(1-e^x/y) means, its is just

Re: [R] curve fitting with given term

2009-01-13 Thread gregor rolshausen
ok. sorry for being blurry. I have x,y data, that probably fits a asymptotic curve (asymptote at N). now I want to fit a curve onto the data, that gives me the N. therefore I thought to fit an e-function, namely N(1-e^(y/x)) onto the data and get the N from the fitted curves' equation. in the

Re: [R] curve fitting with given term

2009-01-13 Thread Ben Bolker
gregor rolshausen gregor.rolshausen at biologie.uni-freiburg.de writes: ok. sorry for being blurry. I have x,y data, that probably fits a asymptotic curve (asymptote at N). now I want to fit a curve onto the data, that gives me the N. therefore I thought to fit an e-function, namely

[R] curve fitting problem

2007-12-24 Thread pieterprovoost
I'm trying to fit a function y=k*l^(m*x) to some data points, with reasonable starting value estimates (I think). I keep getting singular matrix 'a' in solve. This is the code: ox - c(-600,-300,-200,1,100,200) ir - c(1,2.5,4,9,14,20) model - nls(ir ~

Re: [R] curve fitting problem

2007-12-24 Thread Gabor Grothendieck
Your model is singular. Varying m and log(l) have the same effect: log(ir) = log(k) + m * log(l) * ox Also with plinear you don't specify the linear coefficients but rather an X matrix whose coefficients represent them: If we use this model instead: ir = k * exp(m * ox) Then: mod0 -