I'm wondering how I can find/choose the starting values for the nls function as I'm getting errors with any I put in. I also want to confirm that I can actually use the nls function with my data set as I am recording data for weeks in a single year the below are 31 weeks of data.
data
[1] 108 128 93 96 107 126 105 137 78 117 111 131 106 123 112 90 79 106 120
[20] 91 100 103 112 138 61 57 97 100 95 92 78
week = (1:31)
R code for nls function
> data.fit = nls(data~M*(((P+Q)^2/P)*exp((P+Q)*week)/(1+(Q/P)*exp(-(P+Q)*week))^2), start=c(M=?, P=?, Q=?))
This is not an answer but a rather long comment.
It is perfectly understandable that any solver would have a lot of trouble for the fit of such a complex model without providing more than reasonable estimates for parameters $P,Q,M$.
I did want want to work with the data you posted but looking at the model, what we could notice is that $$F(0)=MP$$ $$F'(0)= M P (P+3 Q)$$ Moreover $F(x)$ goes through an extremum value when $$x=\frac{1}{P+Q}\log \left(-\frac{3 Q}{P}\right)$$ So, if the data did not containing errors and the values at $x=0$ were available, probably exploiting these three fact could lead to some resonable estimates.