Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error with best.fit() #8

Open
martik617 opened this issue May 17, 2021 · 2 comments
Open

Getting error with best.fit() #8

martik617 opened this issue May 17, 2021 · 2 comments

Comments

@martik617
Copy link

below is the message after running the best.fit() function on my data:

Error in if (Di < EXPONENTIAL_EPS || Df < EXPONENTIAL_EPS || b < HARMONIC_EPS) Inf else if (abs(Df - :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1])), function(guess) sse(q, :
NA/NaN function evaluation
2: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1])), function(guess) sse(q, :
NA/NaN function evaluation
3: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1])), function(guess) sse(q, :
NA/NaN function evaluation
4: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1]), 1.5), function(guess) sse(q, :
NA/NaN function evaluation
5: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1]), 1.5), function(guess) sse(q, :
NA/NaN function evaluation
6: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1]), 1.5), function(guess) sse(q, :
NA/NaN function evaluation

@martik617
Copy link
Author

Here is my code to reporduce the error:
q <- c(0,0,0,0,0,0,0,0,407.5,244.1,479.3,805.7,423.20000000000005,469.4,92.2,5.5,724,640.9,478.1,388.79999999999995,614.1,405.6,337.70000000000005,344.29999999999995,226.29999999999998,298.70000000000005,255.70000000000002,327.1
,271.5 ,232.6 ,248.9 ,189.39999999999998 ,207.7 ,211 ,165.6 ,115.30000000000001 ,126.4 ,106.2 ,0.1 ,84.3 ,39.5 ,0
,130.3 ,324.5 ,138.4 ,232.1 ,222.7 ,200.3 ,158.2 ,232.5 ,150.6 ,114.8 ,144.2 ,70.1 ,168 ,162 ,135.6
,119.2 ,136.1 ,135.10000000000002 ,0 ,212.4 ,161.39999999999998 ,34.400000000000006 ,179.5 ,114.8
,134.5 ,128.8 ,45.2 ,84.3 ,151.5 ,591.1 ,2194.4 ,2479.8 ,1896.6 ,1369.3 ,1300.6 ,4632.5999999999995 ,6836.7
,5690.6 ,7770.4000000000005 ,7261.4 ,5281.5999999999995 ,6062.1 ,5656.4 ,6497.5000000000009
,5746 ,12247 ,9802.1999999999989 ,10197.199999999997 ,10063.300000000003 ,8515.9 ,5992.0999999999995
,8891 ,6637.3 ,6427.3 ,1281.5 ,1073.1 ,9192.9999999999964 ,5779.7000000000007)

t <- seq(from = 30, to = 3000, by = 30)
df <- data.frame(t,q)
fit <- best.fit(q, t)

@derrickturk
Copy link
Owner

aRpsDCA doesn't currently do a good job of guessing initial declines from data like this, which begins with a series of zero rate values. This may be improved in future releases, especially because the initial guess here of (0 - 0) / 0 = NaN blows up the entire fitting process.

That said, this data needs to be filtered to get any meaningful DCA result. Dropping zero-rate observations will let best.fit run to completion, but looking at a plot of q vs. t shows that this data is not going to be meaningfully fit by a single Arps decline curve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants