Re: [R] Fitting arbitrary curve to 1D data with error bars

2013-11-14 Thread Erkcan Özcan
Thanks, but if you have another closer look to my post, you will see that my question has nothing to do with drawing error bars on a plot. What I want is to do a curve fit to a data with error bars. Best, e. On 14 Nov 2013, at 04:21, Suzen, Mehmet wrote: If you are after adding error bars in

Re: [R] Fitting arbitrary curve to 1D data with error bars

2013-11-14 Thread Suzen, Mehmet
Maybe you are after weights option given by 'lm' or 'glm' See: http://stackoverflow.com/questions/6375650/function-for-weighted-least-squares-estimates On 14 November 2013 10:01, Erkcan Özcan erk...@hotmail.com wrote: Thanks, but if you have another closer look to my post, you will see that my

Re: [R] Fitting arbitrary curve to 1D data with error bars

2013-11-14 Thread Erkcan Özcan
Thanks, this was a useful pointer. Since the function I am trying to fit is exponential, I decided to use nls. And I was able to reproduce exactly the results and the plot in the URL I had posted. For future reference, here is the R code I wrote: require(gplots) xx - 1:10 yy -

[R] Fitting arbitrary curve to 1D data with error bars

2013-11-13 Thread Erkcan Özcan
Dear R experts, I was wondering how I could do a fit (say minimum chi2) to a 1D data with error bars. I searched quite a lot on the web, found out about the fitdistr() function in MASS, etc., but none of the things I found gives what I am really looking for. Perhaps I do not exactly know the

Re: [R] Fitting arbitrary curve to 1D data with error bars

2013-11-13 Thread Suzen, Mehmet
If you are after adding error bars in a scatter plot; one example is given below : #some example data set.seed(42) df - data.frame(x = rep(1:10,each=5), y = rnorm(50)) #calculate mean, min and max for each x-value library(plyr) df2 - ddply(df,.(x),function(df)