Dear all, I am trying to fit a non linear regression model to time series data. If I do this: reg.logis = nls(myVar~SSlogis(myTime,Asym,xmid,scal)) I get this error message (translated to English from French): Erreur in nls(y ~ 1/(1 + exp((xmid - x)/scal)), data = xy, start = list(xmid = aux[1], : le pas 0.000488281 became inferior to 'minFactor' of 0.000976562 I then tried to set the 'minFactor' value like this: reg.logis = nls(myVar~SSlogis(myTime,Asym,xmid,scal),control=nls.control(minFactor=0.000488281)) But I have exactly the same error message, so it seems that the control was not changed If I set some values for the SSlogis function like this: reg.logis=nls(myVar~SSlogis(myTime,Asym=25,xmid=600,scal=13)) or like this: reg.logis=nls(myVar~SSlogis(myTime,Asym=25,xmid=600,scal=13),control=nls.control(minFactor=0.000488281)) I still have the same error message. I have also tried with setting the starting value like this: reg.logis=nls(myVar~SSlogis(myTime,Asym=25,xmid=600,scal=13),control=nls.control(minFactor=0.000488281) + ,start=list(xmid=0,scal=13)) Bu then, I get this error message: Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates Could someone tell me what I am doing wrong? Many thanks Guillaume.
Guillaume Brutel <guillaume.brutel <at> yahoo.fr> writes:> I am trying to fit a non linear regression model to time series data. > > If I do this: > reg.logis = nls(myVar~SSlogis(myTime,Asym,xmid,scal)) > I get this error message (translated to English from French): > Erreur in nls(y ~ 1/(1 + exp((xmid - x)/scal)), data = xy, start = > list(xmid = aux[1], : > le pas 0.000488281 became inferior to 'minFactor' of 0.000976562If it occurs after a few iterations (was it verbose=TRUE; sorry, no docs at hand), almost always means that there is no unique solution. Are you sure that your data level out at 1? Or is a normalization factor needed? Try to repost with the original data set if possible. This error message might also turn up when the start values were totally off, so try to plot the curve and the data with the start values. Setting minFactor never helped for me in that case. Dieter
> > >/ I am trying to fit a non linear regression model to time series data. > />/ > />/ If I do this: > />/ reg.logis = nls(myVar~SSlogis(myTime,Asym,xmid,scal)) > />/ I get this error message (translated to English from French): > />/ Erreur in nls(y ~ 1/(1 + exp((xmid - x)/scal)), data = xy, start = > />/ list(xmid = aux[1], : > />/ le pas 0.000488281 became inferior to 'minFactor' of 0.000976562 > / > If it occurs after a few iterations (was it verbose=TRUE; sorry, no docs at > hand), almost always means that there is no unique solution. Are you sure that > your data level out at 1? Or is a normalization factor needed? Try to repost > with the original data set if possible. This error message might also turn up > when the start values were totally off, so try to plot the curve and the data > with the start values. > > Setting minFactor never helped for me in that case. > > DieterHere is the original dataset I am working on: > myTime Time Series: Start = 0 End = 1066 Frequency = 0.0769230769230769 [1] 0 13 26 39 52 65 78 91 104 117 130 143 156 169 182 [16] 195 208 221 234 247 260 273 286 299 312 325 338 351 364 377 [31] 390 403 416 429 442 455 468 481 494 507 520 533 546 559 572 [46] 585 598 611 624 637 650 663 676 689 702 715 728 741 754 767 [61] 780 793 806 819 832 845 858 871 884 897 910 923 936 949 962 [76] 975 988 1001 1014 1027 1040 1053 1066 > > myVar Time Series: Start = 0 End = 1066 Frequency = 0.0769230769230769 [1] 59.88812 60.32571 60.76331 61.20090 61.63849 58.63085 59.25744 [8] 71.99815 54.14649 25.11732 52.28806 47.93601 38.20542 43.55031 [15] 101.35488 90.63455 79.91422 69.19390 58.47357 41.52232 48.24774 [22] 31.24054 32.98928 35.33158 15.96929 17.73995 19.65816 21.57638 [29] 23.49459 26.14397 28.92629 31.70861 35.75325 46.74069 57.72812 [36] 69.56075 41.51180 27.91007 41.16375 51.24584 60.75127 70.25670 [43] 27.28310 28.82234 30.36158 31.90082 33.44006 34.97930 36.51854 [50] 75.18015 39.08242 53.25049 21.68338 21.72782 24.50556 29.30659 [57] 27.59313 23.92532 20.25751 16.30756 49.36701 87.93636 32.38620 [64] 28.05113 23.89006 27.63523 24.84287 23.81066 35.87769 24.84182 [71] 28.53371 19.53002 13.27322 15.30672 17.34021 29.75360 19.13744 [78] 29.09236 27.75517 26.52083 19.98650 26.09178 54.22785 >
Here is the original dataset I am working on: > myTime Time Series: Start = 0 End = 1066 Frequency = 0.0769230769230769 [1] 0 13 26 39 52 65 78 91 104 117 130 143 156 169 182 [16] 195 208 221 234 247 260 273 286 299 312 325 338 351 364 377 [31] 390 403 416 429 442 455 468 481 494 507 520 533 546 559 572 [46] 585 598 611 624 637 650 663 676 689 702 715 728 741 754 767 [61] 780 793 806 819 832 845 858 871 884 897 910 923 936 949 962 [76] 975 988 1001 1014 1027 1040 1053 1066 > > myVar Time Series: Start = 0 End = 1066 Frequency = 0.0769230769230769 [1] 59.88812 60.32571 60.76331 61.20090 61.63849 58.63085 59.25744 [8] 71.99815 54.14649 25.11732 52.28806 47.93601 38.20542 43.55031 [15] 101.35488 90.63455 79.91422 69.19390 58.47357 41.52232 48.24774 [22] 31.24054 32.98928 35.33158 15.96929 17.73995 19.65816 21.57638 [29] 23.49459 26.14397 28.92629 31.70861 35.75325 46.74069 57.72812 [36] 69.56075 41.51180 27.91007 41.16375 51.24584 60.75127 70.25670 [43] 27.28310 28.82234 30.36158 31.90082 33.44006 34.97930 36.51854 [50] 75.18015 39.08242 53.25049 21.68338 21.72782 24.50556 29.30659 [57] 27.59313 23.92532 20.25751 16.30756 49.36701 87.93636 32.38620 [64] 28.05113 23.89006 27.63523 24.84287 23.81066 35.87769 24.84182 [71] 28.53371 19.53002 13.27322 15.30672 17.34021 29.75360 19.13744 [78] 29.09236 27.75517 26.52083 19.98650 26.09178 54.22785 >