Non linear regression by levels of several groups in R

508 views Asked by At

Take the example of mtcars in R: I want to make a non linear regression for the relationship between mpg and disp with:

nls(data=mtcars, mpg ~ A * disp^2 + B * disp + C, start=list(A=1,B=1,C=1))

But, I need to analyse the relationship for every combination of cyl, gear and carb.

I tried to do this :

 nlsList(data=mtcars, mpg ~ A * disp^2 + B * disp + C | cyl * gear * carb, 
                                              start=list(A=1,B=1,C=1)) 

but I have always errors. The final objective is to plot datas with regression with facets of cyl, gear and carb. Could you help me?

0

There are 0 answers