so I'm new to data science using R and I'm not sure what I'm doing wrong here. using the data set:
rocketBurn | Oxygen Consumed | Hydrogen Used | Trajectory | Thrust |
---|---|---|---|---|
20 | 20000 | 30000 | 0 | 500000 |
40 | 40000 | 60000 | 0 | 525000 |
60 | 60000 | 90000 | 0 | 551250 |
80 | 80000 | 120000 | 4 | 578813 |
100 | 100000 | 150000 | 8 | 593283 |
120 | 120000 | 180000 | 12 | 593283 |
140 | 140000 | 210000 | 16 | 593283 |
160 | 160000 | 240000 | 20 | 593283 |
180 | 180000 | 270000 | 24 | 593283 |
200 | 200000 | 300000 | 28 | 593283 |
220 | 220000 | 330000 | 32 | 593283 |
240 | 240000 | 360000 | 36 | 593283 |
260 | 260000 | 390000 | 40 | 593283 |
280 | 280000 | 420000 | 44 | 593283 |
300 | 300000 | 450000 | 46 | 593283 |
320 | 320000 | 480000 | 46 | 593283 |
I was able to create the linear regression model using the lm() formula in R, when I try to use the nls formula I am recieing the following error message
nlrModel <- nls(Trajectory ~ Oxygen.Consumed + Thrust,data = df,start = c(a=0,b=0,c=0))
Error in nlsModel(formula, mf, start, wts, scaleOffset = scOff, nDcentral = nDcntr) :
singular gradient matrix at initial parameter estimates
After some googling I believe the error is due to the start parms, however, I don't know how to get the correct start parm. Any help on how to get this model to work would be greatly appreciated!
lm()
function. Only when your equation is non-linear should you consider usingnls()
[nonlinear least squares] function!! Since you were able to obtain a result withlm
I am not understanding the question. – Dave2e