1
$\begingroup$

I was wondering how can I best fit nonlinear regression model to this data, using an R package.

How can I check if model is good fitted since $R^2$ value is not returned in most functions for nonlinear models?

data
(source: tarchomin.pl)

$\endgroup$
  • 5
    $\begingroup$ What makes you think this data fits a nonlinear function and what function do you think that is? To me it looks pretty much like a horizontal line with a couple of outliers are 0. $\endgroup$ – John Jun 4 '14 at 15:02
  • $\begingroup$ @John: Might as well partially fit an under-damped harmonic oscillation (hyperphysics.phy-astr.gsu.edu/hbase/oscda.html) or similar function. $\endgroup$ – Aleksandr Blekh Oct 26 '14 at 2:59
1
$\begingroup$

I am not terribly familiar with R but I believe the standard way to perform nonlinear regression is using the nls function. Since you do not say what specific model you are trying to fit to the data, I cannot help you any further. But maybe this small tutorial will help.

Regarding the adequacy of the model, R-squared is indeed not a good statistic. Maybe you can try to compare two or more models using the AIC or BIC values.

$\endgroup$
1
$\begingroup$

As I mentioned in my comment, one possible parametric solution that the data might fit could be an under-damped harmonic oscillation or similar function: http://hyperphysics.phy-astr.gsu.edu/hbase/oscda.html. In terms of non-parametric solutions, I agree with @joaoFaria's answer, but I'd like to extend it a little. You could use nls or optim R functions from the standard stats package: http://cran.r-project.org/doc/manuals/r-release/R-intro.html#Nonlinear-least-squares-and-maximum-likelihood-models.

In addition to the suggested use of AIC and BIC statistics as analytic fit criteria, you also may be interested in regression fit visualization, using, for example, R package visreg (http://cran.r-project.org/web/packages/visreg), which supports both linear and some nonlinear models.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.