Re: [R] Fitting this data with a gaussian would be great
On Sat, 23 Feb 2013, Bryan Hanson wrote: Fortune candidate? Added R-Forge now... :-) thx, Z I hear the landlord is hell, but the company good. Bryan I've already got an apartment reserved for me in one of Pat Burns's R Inferno levels, and I don't want to descend even further. Best, Bert __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fitting this data with a gaussian would be great
Hello, Why do you think your data is gaussian? For what it's worth, qqnorm(small) # doesn't look qqline(small) # gaussian Hope this helps, Rui Barradas Em 22-02-2013 23:27, Samantha Warnes escreveu: Hello,I'm still working with this data set, and trying to fit it with a nonlinear model. Here is my data small - c(507680,507670,508832,510184,511272,513380,515828,519160,525046,534046,547982,567124,590208,614506,637876,656846,669054,672976,668800,656070,637136,614342,590970,570752,554480,542882,535630,531276,528682,527682,527020,526834,526802,526860) test - glm(dnorm(x), data=small) Error in formula.default(object, env = baseenv()) : invalid formula I have tried a variety of options for the formula with the same effect. What I want to do with this data is simply fit it with a non linear model, most likely a gaussian. Thanks in advance, Samantha [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fitting this data with a gaussian would be great
On Feb 23, 2013, at 11:09 AM, Rui Barradas wrote: Hello, Why do you think your data is gaussian? For what it's worth, qqnorm(small) # doesn't look qqline(small) # gaussian It's a bit hard to say with such a small sample, isn't it? Here's a poor man's functional data analysis: plot(density(small), lwd=3, col=red) set.seed(123) for(i in 1:25){ lines(density( rnorm(24, mean(small), sd(small) ) ), col=i ) } for(i in 1:25){ lines(density( rnorm(24, mean(small), sd(small) ) ), col=i ) } for(i in 1:25){ lines(density( rnorm(24, mean(small), sd(small) ) ), col=i ) } for(i in 1:25){ lines(density( rnorm(24, mean(small), sd(small) ) ), col=i ) } I agree that it does appear that the distribution might be reasonably said to be outside the dominant envelope of densities for samples of normals with the same mean and sd, but you do see a few in that are as extreme or more so on some functional eyeball distance metric than a perfect Normal density with the same mean and sd as the offered case. Hope this helps, Rui Barradas Em 22-02-2013 23:27, Samantha Warnes escreveu: Hello,I'm still working with this data set, and trying to fit it with a nonlinear model. Here is my data small - c(507680,507670,508832,510184,511272,513380,515828,519160,525046,534046,547982,567124,590208,614506,637876,656846,669054,672976,668800,656070,637136,614342,590970,570752,554480,542882,535630,531276,528682,527682,527020,526834,526802,526860) test - glm(dnorm(x), data=small) Error in formula.default(object, env = baseenv()) : invalid formula I have tried a variety of options for the formula with the same effect. What I want to do with this data is simply fit it with a non linear model, most likely a gaussian. Thanks in advance, Samantha David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fitting this data with a gaussian would be great
FWIW (It may not be much): 1. Data **are never** Gaussian. Failure to reject the hypothesis that the data are sampled from a Gaussian does not mean that the data can be assumed to be drawn from a Gaussian. That depends on the statistical methodology and the application context. 2. Given a large enough sample, one will always reject the hypothesis that the data are drawn from a Gaussian. That does not mean that nevertheless making that assumption will result in any problems. That depends on the statistical methodology and the application context. 3. Mostly 1) and 2) are of little import anyway, despite what the statistical texts say. Much more important in practice -- and the source of much grief and many irreproducible results -- is the i.i. of iid. ... aka unknown exogenous systematic effects, measurement biases, clustering ... 4. I know this is OT, and I apologize. I also know that this is just my 2 cents opinion -- and probably not really worth even that much -- so feel free to dismiss. Also, if you care to reply or argue, please do so off list. I will not defend anything I've said on list. I've already got an apartment reserved for me in one of Pat Burns's R Inferno levels, and I don't want to descend even further. Best, Bert __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fitting this data with a gaussian would be great
Fortune candidate? I hear the landlord is hell, but the company good. Bryan I've already got an apartment reserved for me in one of Pat Burns's R Inferno levels, and I don't want to descend even further. Best, Bert __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fitting this data with a gaussian would be great
Samantha Warnes warnes at wisc.edu writes: Hello,I'm still working with this data set, and trying to fit it with a nonlinear model. Here is my data small - c(507680,507670,508832,510184,511272,513380,515828, 519160,525046, 534046,547982,567124,590208,614506,637876,656846,669054,672976,668800, 656070,637136,614342,590970,570752,554480,542882,535630,531276,528682, 527682,527020,526834,526802,526860) test - glm(dnorm(x), data=small) Error in formula.default(object, env = baseenv()) : invalid formula I'm sorry, but as stated the question doesn't make much sense. You haven't stated your nonlinear model at all, and you haven't said anything about any predictor variables. If you want fit a *constant* normal model you can 1. Compute the mean and standard deviation of the data (which are the parameters of the model): mean(small), sd(small) 2. use an intercept-only model with lm(small~1) or glm(small~1) (although the latter is definitely overkill) 3. You *can* use a nonlinear fitting method to estimate an intercept-only model nls(small~a,start=list(a=564000)) but it doesn't really mean much. Ben Bolker __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.