Beyond Linear Modeling using R (part-2)

In a previous post we fitted a non linear model to some randomly generated data. Here we will a different type of non-linear function and evaluate the results.

Modeling

In this approach we will model the same data generated by the previous post but the relationship between x and y will be modeled with an exponential function:

With the following script we will directly fit an exponential model using again the nls() function.

The model estimated that b = -4.114140 ± 0.1802758 and a = 4.214029 ± 0.1998630. Additionally, both of these variables are highly significant (p << 0.05).

Plotting

Plotting the fitted model and the cubic approximation we have the following graph:

We can see that the fitted model is close to the cubic model that we used initially.

Goodness of fit

To examine the goodness of fit of the model, we will calculate R squared, seen in a previous post for linear regression:

R squared is calculated at 0.9764 which is a very good result highlighting the overall good performance of the model. Also, it is slightly smaller than the respective measure of the power model used in the previous post.

No Comments

Sorry, the comment form is closed at this time.

× How can we help you?