Skip to main content

fitting - What can I do to eliminate the error FindFit::nrjnum:?


I am testing the "Power Law with finite-time singularity" hypothesis for world population growth for a project.


The data I'm using (same behaviour should also be exhibited by the stock market, thats why I am trying this with financial data):


raw = FinancialData["GE", All];
fraw = Flatten[raw];
data = Table[fraw[[4*i]], {i, 1, Length[raw]}]; (*extracting just the prices*)


I was trying the following regression model:


model = A + B*(c - x)^z;

And then the following curve fit method:


FindFit[data, {model}, {A, B, c, z}, x]

But I always get the result:



Power::indet: "Indeterminate expression 0.^0. encountered." FindFit::nrjnum: "The Jacobian is not a matrix of real numbers at {A, B, c, z} = {1., 1., 1., 1.}. "


{A -> 1., B -> 1., c -> 1., z -> 1.}




If I do a normal Power law regression, FindFit works perfectly, but the title of the project being "Power Law with finite-time singularity" I need to have the singularity c in the model and the main aim is to find when this singularity occurs.


Is there a way to use FindFit to get the correct answer? Or should I be using some other function?


I have seen other articles on this site concerning issues with FindFit, but none of them has helped me resolve this problem.


Remark: I have already tried the version belisarius has stated below, but the problem with that is that it gives me a z > 0. What I need is z < 0 for x = c to be a singularity. So I also tried the following models: A + B*Abs[c - x]^(-z) and A + B*(c - x)^(-z) with -z instead of z but those just gave me like 15 other warnings.




Comments