I was doing some analysis of my power bill and was trying to extract how much the air conditioning unit is using. By assuming that "normal" power use is fairly constant over the year and that the A/C is only on during the hotter months, I was able to estimate some separation.
In the figure there are two lines:
- the linear showing "normal use", cumulative
- the sigmoidal showing AC use, cumulative
In trying to fit a good model through this total cumulative use, the nls function in R gave the dreaded singular gradient matrix at initial parameter estimates. Using different software (JMP) I could get good initial parameters, which are reflected in the purple fit curve.
Any idea how I can use R to get parameter estimates without the error?
nls model
nls(elec_use_mean ~ b0 + b1 * month + a1 / (a2 + a3 * exp(a4 * month)),
start = list(b0 = 100, b1 = 310, a1 = 1300, a2 = 0.3, a3 = 600, a4 = -1.2),
data = cumulative
)
Error in nlsModel(formula, mf, start, wts, scaleOffset = scOff, nDcentral = nDcntr) :
singular gradient matrix at initial parameter estimates
Data:
month,elec_use_mean
1,461.46
2,839.46
3,1197.92
4,1553.59
5,2093.34
6,3096.42
7,4353.67
8,5652.51
9,6729.84
10,7296.92
11,7634.34
12,8071.84


