Search code examples
rnls

In nlsplot(), how to see the model equation in R?


I generated one data

nitrogen<- c(0,40,80,120,160,260)
yield <- c(8.4,9.8,10.8,12.5,11.1,12.7)
dataA<- data.frame(nitrogen, yield)

and I'd like to see this data as quadratic-plateau model. So I used nlsplot() code.

install.packages("easynls")
library(easynls)
nlsplot(dataA, model=4)

enter image description here

The model equation is covered in the graph. I'd like to see the full model equation about this quadratic-plateau model.

Could you let me know how to do it?

Always many thanks!!


Solution

  • One solution could be using par() function to adjust the plot size and font size arguments within par() and then run nlsplot():

    # change the font size for the plot
    par(cex.lab = 1.5, cex.axis = 1.5, cex=1.2)
    
    # plot the data with formula
    nlsplot(dataA, model = 4)
    

    enter image description here Now I change the font size of the formula to 0.8 to cover better.You can play with the par() arguments to adjust your plot.

    par(cex.lab = 1, cex.axis = 1, cex=0.8)
    
    nlsplot(dataA, model = 4)
    

    enter image description here