Hi,
I get this error on fBasics::dstable function:
--- [CUT HERE] ---
Error in dstable(y, alpha = alpha, beta = beta, gamma = gamma, delta =
delta) : object "result" not found
--- [/CUT HERE] ---
Looking at the code ("2A-StableDistribution.R"), it seems it is
sufficient to add an initialization instruction, for instance, at line
442:
--- [CUT HERE] ---
result = 0; # ADDED INITIALIZATION
# Special Cases:
if (alpha == 2) {
result = dnorm(x, mean = 0, sd = sqrt(2))
}
if (alpha == 1 & beta == 0) {
result = dcauchy(x)
}
--- [/CUT HERE] ---
Furthermore, I think the test on "beta" ("... & abs(beta) <= 1") at
line 454 is useless because of test at lines 425 and 426 ("if (beta <
-1) ...." and "if (beta > -1) ...", respectively).
My system is:
CPU: AMD Turion x2 TL-52
RAM: 1GB
OS: Fedora 7 x86_64
R: v. 2.5.1
fBasics. fCalendar, fEcofin: v. 251.70
Sincerely,
-- Marco
Error on "fBasics::dstable"
3 messages · Shiazy Fuzzy
On 8/26/07, Shiazy Fuzzy <shiazy at gmail.com> wrote:
Hi,
I get this error on fBasics::dstable function:
--- [CUT HERE] ---
Error in dstable(y, alpha = alpha, beta = beta, gamma = gamma, delta =
delta) : object "result" not found
--- [/CUT HERE] ---
Looking at the code ("2A-StableDistribution.R"), it seems it is
sufficient to add an initialization instruction, for instance, at line
442:
--- [CUT HERE] ---
result = 0; # ADDED INITIALIZATION
# Special Cases:
if (alpha == 2) {
result = dnorm(x, mean = 0, sd = sqrt(2))
}
if (alpha == 1 & beta == 0) {
result = dcauchy(x)
}
--- [/CUT HERE] ---
Furthermore, I think the test on "beta" ("... & abs(beta) <= 1") at
line 454 is useless because of test at lines 425 and 426 ("if (beta <
-1) ...." and "if (beta > -1) ...", respectively).
My system is:
CPU: AMD Turion x2 TL-52
RAM: 1GB
OS: Fedora 7 x86_64
R: v. 2.5.1
fBasics. fCalendar, fEcofin: v. 251.70
Sincerely,
-- Marco
Here is a reproducible example:
--- [CUT HERE] ---
library(fBasics);
x <- c( 492408, 1897, 66795, 4014, 14, 11, 5770, 4284, 672, 50, 769,
21, 28, 13, 76, 29, 37, 28, 114, 63, 1479, 166, 999, 117, 8, 14, 206,
231, 85, 74684, 1130, 475, 657, 27, 230, 607, 1460, 116, 125, 2058,
3413, 69110, 20, 43, 406, 147, 314, 69, 310, 21, 1059, 986 );
stableFit( x,type=c("mle"),doplot=F );
--- [/CUT HERE] ---
With the above corrections, the problem seems to be partially solved
... Partially because I found out if you specifiy 'doplot = TRUE', the
same error happens in "qstable" method:
--- [CUT HERE] ---
Error in qstable(0.01, alpha, beta) : object "result" not found
--- [/CUT HERE] ---
Note this error appears only if you have already corrected the
"dstable" method; otherwise execution stops before.
I've tried to fix it with the same kind of corrections done for
"dstable" (added "result=NULL;" to line 767. However, I got a new
error (in place of the above):
--- [CUT HERE] ---
Error in if (from == to) rep.int(from, length.out) else as.vector(c(from, :
argument is of length zero
--- [/CUT HERE] ---
Let me know if there's a better solution or if I'm wrong.
Thank you so much!
Sincerely,
-- Marco
On 8/26/07, Shiazy Fuzzy <shiazy at gmail.com> wrote:
On 8/26/07, Shiazy Fuzzy <shiazy at gmail.com> wrote:
Hi,
I get this error on fBasics::dstable function:
--- [CUT HERE] ---
Error in dstable(y, alpha = alpha, beta = beta, gamma = gamma, delta =
delta) : object "result" not found
--- [/CUT HERE] ---
Looking at the code ("2A-StableDistribution.R"), it seems it is
sufficient to add an initialization instruction, for instance, at line
442:
--- [CUT HERE] ---
result = 0; # ADDED INITIALIZATION
# Special Cases:
if (alpha == 2) {
result = dnorm(x, mean = 0, sd = sqrt(2))
}
if (alpha == 1 & beta == 0) {
result = dcauchy(x)
}
--- [/CUT HERE] ---
Furthermore, I think the test on "beta" ("... & abs(beta) <= 1") at
line 454 is useless because of test at lines 425 and 426 ("if (beta <
-1) ...." and "if (beta > -1) ...", respectively).
My system is:
CPU: AMD Turion x2 TL-52
RAM: 1GB
OS: Fedora 7 x86_64
R: v. 2.5.1
fBasics. fCalendar, fEcofin: v. 251.70
Sincerely,
-- Marco
Here is a reproducible example:
--- [CUT HERE] ---
library(fBasics);
x <- c( 492408, 1897, 66795, 4014, 14, 11, 5770, 4284, 672, 50, 769,
21, 28, 13, 76, 29, 37, 28, 114, 63, 1479, 166, 999, 117, 8, 14, 206,
231, 85, 74684, 1130, 475, 657, 27, 230, 607, 1460, 116, 125, 2058,
3413, 69110, 20, 43, 406, 147, 314, 69, 310, 21, 1059, 986 );
stableFit( x,type=c("mle"),doplot=F );
--- [/CUT HERE] ---
With the above corrections, the problem seems to be partially solved
... Partially because I found out if you specifiy 'doplot = TRUE', the
same error happens in "qstable" method:
--- [CUT HERE] ---
Error in qstable(0.01, alpha, beta) : object "result" not found
--- [/CUT HERE] ---
Note this error appears only if you have already corrected the
"dstable" method; otherwise execution stops before.
I've tried to fix it with the same kind of corrections done for
"dstable" (added "result=NULL;" to line 767. However, I got a new
error (in place of the above):
--- [CUT HERE] ---
Error in if (from == to) rep.int(from, length.out) else as.vector(c(from, :
argument is of length zero
--- [/CUT HERE] ---
Let me know if there's a better solution or if I'm wrong.
Thank you so much!
Sincerely,
-- Marco
Hmmm ... another error, this time in "pstable":
--- [CUT HERE] ---
Error in attr(ans, "control") = cbind.data.frame(dist = "stable",
alpha = alpha, :
attempt to set an attribute on NULL
--- [/CUT HERE] ---
To reproduce:
--- [CUT HERE] ---
library(fBasics);
x <- c( 492408, 1897, 66795, 4014, 14, 11, 5770, 4284, 672, 50, 769,
21, 28, 13, 76, 29, 37, 28, 114, 63, 1479, 166, 999, 117, 8, 14, 206,
231, 85, 74684, 1130, 475, 657, 27, 230, 607, 1460, 116, 125, 2058,
3413, 69110, 20, 43, 406, 147, 314, 69, 310, 21, 1059, 986 );
fit <- stableFit( x,type=c("mle"),doplot=F );
pstable( x, alpha=fit at fit$estimate["alpha"],
beta=fit at fit$estimate["beta"], gamma=fit at fit$estimate["gamma"],
delta=fit at fit$estimate["delta"] );
--- [/CUT HERE] ---
-- Marco