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) with

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 gener

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. > >Berna

[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() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-26 Thread Jeff Newmiller
I think you are going to have to be more specific than "having some trouble". Your plot used lka as the x-axis. FWIW note that lm(ruotsi.pist ~ mies + koulu + clka + koulu*clka, data=dta) is the same as lm(ruotsi.pist ~ mies + koulu*clka, data=dta) -- Sent from my phone. Please excuse my brev

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-26 Thread Greg Snow
If your goal is to visualize the predicted curve from an lm fit (or other model fit) then you may want to look at the Predict.Plot and TkPredict functions from the TeachingDemos package. On Sun, Sep 25, 2016 at 7:01 AM, Matti Viljamaa wrote: > I’m trying to plot regression lines using curve()

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-26 Thread Matti Viljamaa
> On 26 Sep 2016, at 19:41, Matti Viljamaa wrote: > > Thank you. > > However, I’m having some trouble converting your code to use clka, because > the model I was using was: > > fit2 <- lm(ruotsi.pist ~ mies + koulu + clka + koulu*clka, data=dta) I mean, not to use clka to replace lka. But to

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-26 Thread Matti Viljamaa
Thank you. However, I’m having some trouble converting your code to use clka, because the model I was using was: fit2 <- lm(ruotsi.pist ~ mies + koulu + clka + koulu*clka, data=dta) > On 25 Sep 2016, at 21:23, Jeff Newmiller wrote: > > This illustrates why you need to post a reproducible exa

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Jeff Newmiller
This illustrates why you need to post a reproducible example. You have a number of confounding factors in your code. First, "data" is a commonly-used function... avoid using it for variable names. Second, using the attach function this way leads to confusion... best to forget this function u

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Matti Viljamaa
> On 25 Sep 2016, at 19:37, Matti Viljamaa wrote: > > Okay here’s a pretty short code to reproduce it: > > data <- > read.table("http://users.jyu.fi/~slahola/files/glm1_datoja/yoruotsi.txt";, > header=TRUE) data$clka <- I(data$lka - mean(data$lka)) > attach(data) > > fit2 <- lm(ruotsi.pist

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Jeff Newmiller
Object clka not found. Did you test run it in a fresh R environment? -- Sent from my phone. Please excuse my brevity. On September 25, 2016 9:37:56 AM PDT, Matti Viljamaa wrote: >Okay here’s a pretty short code to reproduce it: > >data <- >read.table("http://users.jyu.fi/~slahola/files/glm1_da

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Matti Viljamaa
Okay here’s a pretty short code to reproduce it: data <- read.table("http://users.jyu.fi/~slahola/files/glm1_datoja/yoruotsi.txt";, header=TRUE) attach(data) fit2 <- lm(ruotsi.pist ~ mies + koulu + lka + koulu*clka) bs <- coef(fit2) varitB <- c(data[koulu == 'B',]$mies) varitB[varitB == 0] =

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Jeff Newmiller
Go directly to C. Do not pass go, do not collect $200. You think curve does something, but you are missing what it actually does. Since you don't seem to be learning from reading ?curve or from our responses, you need to give us an example you can learn from. -- Sent from my phone. Please excu

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread mviljamaa
On 2016-09-25 18:52, Jeff Newmiller wrote: You seem to be confused about what curve is doing vs. what you are doing. But my x-range in curve()'s parameters from and to should be the entire lka vector, since they are from=min(lka) and to=max(lka). Then why does this not span the entire of lka?

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Jeff Newmiller
You seem to be confused about what curve is doing vs. what you are doing. A) Compute the points you want to plot and put them into 2 vectors. Then figure out how to plot those vectors. Then (perhaps) consider putting that all into one line of code again. B) The predict function is the preferr

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread mviljamaa
On 2016-09-25 18:30, Duncan Murdoch wrote: On 25/09/2016 9:10 AM, Matti Viljamaa wrote: Writing: bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*lka+bs["kouluB:clka"]*clka i.e. without that being inside curve produces a vector of length 375. So now it seems that curve() is really skippi

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Duncan Murdoch
On 25/09/2016 9:10 AM, Matti Viljamaa wrote: Writing: bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*lka+bs["kouluB:clka"]*clka i.e. without that being inside curve produces a vector of length 375. So now it seems that curve() is really skipping some lka-/x-values. How could curve() k

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Matti Viljamaa
Writing: bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*lka+bs["kouluB:clka"]*clka i.e. without that being inside curve produces a vector of length 375. So now it seems that curve() is really skipping some lka-/x-values. > On 25 Sep 2016, at 16:01, Matti Viljamaa wrote: > > I’m trying

[R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Matti Viljamaa
I’m trying to plot regression lines using curve() The way I do it is: bs <- coef(fit2) and then for example: curve(bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*x+bs["kouluB:clka"]*clka, from=min(lka), to=max(lka), add=TRUE, col='red') This above code runs into error: Error in curve(

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 - Gius

Re: [R] curve comparison

2012-07-31 Thread David Winsemius
A.K From: Luis Fernando García Hernández To: arun Sent: Monday, July 30, 2012 9:00 PM Subject: Re: [R] curve comparison Thanks both for your answer, Will, do you have any reference which shows me how how to perform this analysis? I´d like to know to find out how to do it. In my case da

Re: [R] curve comparison

2012-07-31 Thread arun
/geyer/old/5601/examp/kolmogorov.html). I am not very familiar with non-parametric tests. A.K. From: Luis Fernando García Hernández To: arun Sent: Monday, July 30, 2012 9:00 PM Subject: Re: [R] curve comparison Thanks both for your answer,  Will, do you

Re: [R] curve comparison

2012-07-30 Thread arun
: Monday, July 30, 2012 1:38 AM Subject: [R] curve comparison Dear R users, I have seven regression lines I´d like to compare, in order to find out if these are significatively different. The main problem is that these are curves,  non normal, non homogeneous data, I´ve tried to linearize them but

Re: [R] curve comparison

2012-07-30 Thread Will Shadish
I'm very much a novice with R, and not a statistician. But as my group has been working with generalized additive models (semi-parametric regression), we have followed Wood's advice about using the R anova function to do model comparison for different regressions. I would imagine at least some

[R] curve comparison

2012-07-29 Thread Luis Fernando García Hernández
Dear R users, I have seven regression lines I´d like to compare, in order to find out if these are significatively different. The main problem is that these are curves, non normal, non homogeneous data, I´ve tried to linearize them but it has not worked. So I´d like to know if you know any comman

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 ## te

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 wrote: > Dear all, > > This is probably more related to statistics than to [R] but I hope someone > can give me an idea h

[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 interval[0

Re: [R] curve fitted ... how to retreive data

2011-12-09 Thread Mintewab Bezabih
THanks so much Gene, it worked mintewab Från: gley...@gmail.com [gley...@gmail.com] för Gene Leynes [gleyne...@gmail.com] Skickat: den 7 december 2011 18:43 Till: Mintewab Bezabih Kopia: r-help@r-project.org Ämne: Re: [R] curve fitted ... how to retreive

Re: [R] curve fitted ... how to retreive data

2011-12-07 Thread Gene Leynes
For the components: result = predict(b, type="terms") For the total fit: result = predict(b) result = b$fitted.values On Wed, Dec 7, 2011 at 3:24 AM, Mintewab Bezabih < mintewab.beza...@economics.gu.se> wrote: > Dear R users, > > I have now managed to fit the curve using the thin plate spline a

[R] curve fitted ... how to retreive data

2011-12-07 Thread Mintewab Bezabih
Dear R users, I have now managed to fit the curve using the thin plate spline as follows: library(mgcv) b <- gam(y~s(x1,x2,k=100),data =dat) vis.gam(b) What I want now is to get the fitted data for y and copy it so that I use it for further analysis. Many thanks in advance mintewab

Re: [R] curve

2010-12-14 Thread Peter Ehlers
On 2010-12-14 08:43, Sarah Goslee wrote: You are most likely to get reasonable help if you provide at a minimum your OS, the version of R you're using, and the error message you get. And also if you send your replies to the R-help list, not just me. Sarah Sarah's code works perfectly well on

Re: [R] curve

2010-12-14 Thread Sarah Goslee
You are most likely to get reasonable help if you provide at a minimum your OS, the version of R you're using, and the error message you get. And also if you send your replies to the R-help list, not just me. Sarah On Tue, Dec 14, 2010 at 10:58 AM, Val wrote: > Thank you Sarah, > > > It worked

Re: [R] curve

2010-12-14 Thread Sarah Goslee
Val, Here's the complete console output. The graph produced is at: http://www.functionaldiversity.org/temp/curve.png R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-redhat-linux-gnu (64-bit) R is free software and co

Re: [R] curve

2010-12-13 Thread Sarah Goslee
On Mon, Dec 13, 2010 at 2:12 PM, Ashta wrote: > Thanks Sarah, > >> 1. to shade or color (blue) the curve using the criterion that any values >> greater than 11,000 > > I think I was not clear in the above point. I want shade not the line but > the area under the curve, Here's an example of how to

Re: [R] curve

2010-12-13 Thread Ashta
Thanks Sarah, > 1. to shade or color (blue) the curve using the criterion that any values greater than 11,000 I think I was not clear in the above point. I want shade not the line but the area under the curve, and Your last line of code, segments(x0=mean(test1), y0=0, y1=curveheight) gave me th

Re: [R] curve

2010-12-13 Thread Sarah Goslee
Here's one way to do what I think you want: test<- rnorm(5000,1000,100) test1 <- subset(test, subset=(test > 1100)) d <- density(test) plot(d, main="Density of production", xlab="") lines(d$x[d$x > 1100], d$y[d$x > 1100], col="blue", lwd=2) curveheight <- d$

[R] curve

2010-12-13 Thread Val
Hi All, I generated 5000 samples using the following script test<- rnorm(5000,1000,100) test1 <- subset(test, subset=(test > 1100)) d <- density(test) plot(d, main="Density of production") abline(v=mean(test1) I wanted to do the following but faced diffic

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

2010-05-02 Thread Kyeong Soo (Joseph) Kim
ovided some technical and practical information which I could learn >> from and be very thankful for. >> >> Regards, >> Joseph >> >> On Fri, Apr 30, 2010 at 11:35 PM, Greg Snow >> wrote: >> > >> >> -Original Message----- >>

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

2010-04-30 Thread Greg Snow
nal 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

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

2010-04-30 Thread Kyeong Soo (Joseph) Kim
lto: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 won

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

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 - i

Re: [R] Curve Fitting

2010-04-30 Thread apjaworski
ct.org Date: 04/30/2010 03:33 PM Subject: [R] Curve Fitting Sent by: 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 exam

[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 su

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

2010-04-30 Thread Kyeong Soo (Joseph) Kim
gsoo@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 to it. > > But, you misunde

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

2010-04-30 Thread Kyeong Soo (Joseph) Kim
n wrote: >> > Dear Joseph, >> > >> > If you do not need to make any inferences, that is, you >> just want it to look pretty, then drawing a curve by hand is >> as good a solution as any. Plus, there is no reason for >> expert testimony to say that the cu

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

2010-04-30 Thread kMan
eithC. -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 re

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

2010-04-30 Thread Liaw, Andy
rve does not mean anything. > > > > Sincerely, > > KeithC. > > > > -Original Message- > > From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] > > Sent: Tuesday, April 27, 2010 2:33 PM > > To: Gabor Grothendieck > > Cc: r

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

2010-04-30 Thread Kyeong Soo (Joseph) Kim
m: 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. >

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&#

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 high-l

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 <- with(

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 ob

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,

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

[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 o

Re: [R] curve

2010-04-16 Thread Dwayne Blind
.org > 801.408.8111 > > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > > project.org] On Behalf Of Duncan Murdoch > > Sent: Thursday, April 15, 2010 7:29 AM > > To: Dwayne Blind > > Cc: r-help@r-project.org

Re: [R] curve

2010-04-15 Thread Greg Snow
Behalf Of Duncan Murdoch > Sent: Thursday, April 15, 2010 7:29 AM > To: Dwayne Blind > Cc: r-help@r-project.org > Subject: Re: [R] curve > > On 14/04/2010 4:59 PM, Dwayne Blind wrote: > > Dear R users, > > > > How can I use "curve" with a function of two va

Re: [R] curve

2010-04-15 Thread Duncan Murdoch
On 14/04/2010 4:59 PM, Dwayne Blind wrote: Dear R users, How can I use "curve" with a function of two variables ? See Ben Bolker's reply if you want to plot a surface. If you want to plot a curve by holding one of the two variables fixed, just set it to a constant value, and use "x" as t

Re: [R] curve

2010-04-14 Thread Ben Bolker
Dwayne Blind gmail.com> writes: > How can I use "curve" with a function of two variables ? see "curve3d" in the emdbook package. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://

[R] curve

2010-04-14 Thread Dwayne Blind
Dear R users, How can I use "curve" with a function of two variables ? Thank you very much, Dwayne [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the postin

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:

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 wrote: > Hi to all > > This is the first time I am quoting a question and I hope, my question is > not too basic... > > For the

[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 <- c(14.42,26.96,31.3,19.95,36.36,15.4,24.76,35.39,28.07,40.9

Re: [R] curve from a formula with ggplot2

2009-07-17 Thread Benoit Boulinguiez
: r-help@r-project.org Objet : Re: [R] curve from a formula with ggplot2 Hi Benoit, Have a look at http://had.co.nz/ggplot2/stat_function.html. Does that help? Hadley On Tue, Jul 7, 2009 at 11:15 AM, Benoit Boulinguiez wrote: > Hi all, > > I'm smoothly transferring my lattice

Re: [R] curve from a formula with ggplot2

2009-07-12 Thread hadley wickham
Hi Benoit, Have a look at http://had.co.nz/ggplot2/stat_function.html. Does that help? Hadley On Tue, Jul 7, 2009 at 11:15 AM, Benoit Boulinguiez wrote: > Hi all, > > I'm smoothly transferring my lattice graphs to ggplot2 graphs, but I'm stuck > on representing a curve from a formula. > I'm loo

[R] curve from a formula with ggplot2

2009-07-07 Thread Benoit Boulinguiez
Hi all, I'm smoothly transferring my lattice graphs to ggplot2 graphs, but I'm stuck on representing a curve from a formula. I'm looking for the equivalent of curve() in ggplot2, Hadley Wickham mentions geom_curve, but as far as I've seen in the help it doesn't exist. My need is to plot a regul

[R] Curve fit a nonlinear equation with box constraints: success, many thanks!

2009-06-17 Thread Stu @ AGS
Dear R Helper Community! Thank you for all your help and suggestions. For your reference and any future person searching the archives, here is the solution that did what I wanted it to do. As background, my goal was to find the coefficients for the following equation form: y ~ c1 * x1 *

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 <- nls.lm(par

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 wrote: > 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 =

[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,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 l

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 of

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 wrote: > > Here is the gif that didn't come through earlier > http://www.nabble

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. _

[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 with given term

2009-01-13 Thread Ben Bolker
gregor rolshausen 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 N(1-e^(y/x)) onto

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 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 jus

[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 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 <- lm(log(

[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 ~ k*l^(m*ox),start=list(k=10,l=3,m=0.004