[R] Stable package on Windows doesn't work???

Jim Lindsey jlindsey at alpha.luc.ac.be
Wed Dec 8 10:30:20 CET 1999


Yves:
  I am completely baffled by this. I include below my output for these
examples from Intel Pentium II RH5.2 Linux with R90. I get exactly the
same results with MS Windows 98 and R65 on the same machine. I also
tried with R90 and MS Windows 95 on an older Pentium and also got the
same results. What machine exactly did you run this on?
  R-help will remember that I have complained before about numerical
problems with MS Windows but this one beats me. Jim

> 
> Hi Jim,
> 
> Troels Ring told me to get Version 0.7 which I did.
> 
> It's probably me that doesn't understand how it works (I'm new to R) but
> stablereg is supposed to find the most appropriate parameters for the stable
> distribution (loc, disp, skew, tail) given some starting values right?
> 
> When I try the examples that are given with the function help file I get the
> following results.
> 
> ************************************************************
> R : Copyright 1999, The R Development Core Team
> Version 0.90.0  (November 22, 1999)
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type   "?license" or "?licence" for distribution details.
> 
> R is a collaborative project with many contributors.
> Type   "?contributors" for a list.
> 
> Type   "demo()" for some demos, "help()" for on-line help, or
>         "help.start()" for a HTML browser interface to help.
> Type    "q()" to quit R.
> 
> > library(stable)
> Loading required package: rmutil
> > help(stablereg)
> > ## Share return over a 50 day period (see reference above)
> >         # shares
> >         y <-
> c(296,296,300,302,300,304,303,299,293,294,294,293,295,287,288,297,
> +
> 305,307,307,304,303,304,304,309,309,309,307,306,304,300,296,301,298,
> +
> 295,295,293,292,297,294,293,306,303,301,303,308,305,302,301,297,299)
> >
> >         # returns
> >         ret <- (y[2:50]-y[1:49])/y[1:49]
> >         # hist(ret, breaks=seq(-0.035,0.045,0.01))
> >
> >         day <- seq(0,0.48,by=0.01) # time measured in days/100
> >         x <- seq(1,length(ret))-1
> >
> >         # Classic stationary normal model tail=2
> >         print(z1 <- stablereg(y = ret, delta = 1/y[1:49],
> +              loc = ~ 1, disp= ~ 1, skew = ~ 1, tail = tail.g(1.9999999),
> +              iloc = 0, idisp = 0, iskew = 0, otail = F, oskew = F))
> 
> Call:
> stablereg(y = ret, delta = 1/y[1:49], loc = ~1, disp = ~1, skew = ~1,
>     tail = tail.g(1.9999999), iloc = 0, idisp = 0, iskew = 0,
>     otail = F, oskew = F)
> 
> Warning: no convergence - error 5
> 
> -Log likelihood              292.4987
> No. of obs                   49
> No. of estimated parameters  2
> No. of parameters            4
> Degrees of freedom           47
> AIC                          294.4987
> Iterations                   1
> 
> Location parameters
> ~1
>               estimate       se
> (Intercept)  0.0001445  0.07433
> 
> Dispersion parameters
> ~1
>              estimate     se
> (Intercept)        -1  4.055
> 
> Correlations:
>          1        2
> 1  1.00000 -0.01525
> 2 -0.01525  1.00000
> >
> >         # Normal model (tail=2) with dispersion=disp.h(b0+b1*day)
> >         print(z2 <- stablereg(y = ret, delta = 1/y[1:49],
> +              loc = ~ day, disp = ~ 1, skew = ~ 1, tail = tail.g(1.999999),
> +              iloc = c(0,0), idisp = 0, iskew = 0, oskew = F, otail =F))
> 
> Call:
> stablereg(y = ret, delta = 1/y[1:49], loc = ~day, disp = ~1,
>     skew = ~1, tail = tail.g(1.999999), iloc = c(0, 0), idisp = 0,
>     iskew = 0, oskew = F, otail = F)
> 
> Warning: no convergence - error 5
> 
> -Log likelihood              292.4987
> No. of obs                   49
> No. of estimated parameters  3
> No. of parameters            5
> Degrees of freedom           46
> AIC                          295.4987
> Iterations                   1
> 
> Location parameters
> ~day
>                estimate      se
> (Intercept)   1.445e-04  0.1467
> day          -6.053e-06  0.5265
> 
> Dispersion parameters
> ~1
>              estimate     se
> (Intercept)        -1  4.063
> 
> Correlations:
>          1        2        3
> 1  1.00000 -0.86207 -0.06098
> 2 -0.86207  1.00000  0.06159
> 3 -0.06098  0.06159  1.00000
> >
> >         # Stable model with loc(ation)=loc.h(b0+b1*day)
> >         print(z3 <- stablereg(y = ret, delta = 1/y[1:49],
> +              loc = ~ day, disp = ret ~ 1, skew = ~ 1, tail = ~ 1,
> +              iloc = c(0.001,0), idisp = 0, iskew = 0, itail = 0))
> 
> Call:
> stablereg(y = ret, delta = 1/y[1:49], loc = ~day, disp = ret ~
>     1, skew = ~1, tail = ~1, iloc = c(0.001, 0), idisp = 0, iskew = 0,
>     itail = 0)
> 
> Warning: no convergence - error 5
> 
> -Log likelihood              291.591
> No. of obs                   49
> No. of estimated parameters  5
> No. of parameters            5
> Degrees of freedom           44
> AIC                          296.591
> Iterations                   1
> 
> Location parameters
> ~day
>                estimate       se
> (Intercept)   0.0004749  0.08946
> day          -0.0001862  0.43214
> 
> Dispersion parameters
> ret ~ 1
>              estimate     se
> (Intercept)   -0.9998  3.340
> 
> Skew parameters
> ~1
>                estimate   se
> (Intercept)  -0.0002456  NaN
> 
> Tail parameters
> ~1
>              estimate   se
> (Intercept)  -0.02018  NaN
> 
> Correlations:
>          1        2        3   4   5
> 1  1.00000 -1.15904 -0.06692 NaN NaN
> 2 -1.15904  1.00000  0.06058 NaN NaN
> 3 -0.06692  0.06058  1.00000 NaN NaN
> 4      NaN      NaN      NaN NaN NaN
> 5      NaN      NaN      NaN NaN NaN
> Warning message:
> NaNs produced in: sqrt(diag(cov))
> >
> >         # Stable model with disp(ersion)=disp.h(b0+b1*day)
> >         print(z4 <- stablereg(y = ret, delta = 1/y[1:49],
> +              loc = ret ~ 1, disp = ~ day, skew = ~ 1, tail = ~ 1,
> +              iloc = 0, idisp = c(-4.5,0), iskew = -2, itail = 1))
> 
> Call:
> stablereg(y = ret, delta = 1/y[1:49], loc = ret ~ 1, disp = ~day,
>     skew = ~1, tail = ~1, iloc = 0, idisp = c(-4.5, 0), iskew = -2,
>     itail = 1)
> 
> -Log likelihood              132.1774
> No. of obs                   49
> No. of estimated parameters  5
> No. of parameters            5
> Degrees of freedom           44
> AIC                          137.1774
> Iterations                   70
> 
> Location parameters
> ret ~ 1
>              estimate        se
> (Intercept)  0.000938  0.001892
> 
> Dispersion parameters
> ~day
>              estimate       se
> (Intercept)   -4.6768  0.06621
> day           -0.6556  0.61348
> 
> Skew parameters
> ~1
>              estimate   se
> (Intercept)    -10.87  NaN
> 
> Tail parameters
> ~1
>              estimate      se
> (Intercept)    0.6575  0.6067
> 
> Correlations:
>         1       2       3   4       5
> 1  1.0000 -1.0000  0.8075 NaN -0.3810
> 2 -1.0000  1.0000 -0.8075 NaN  0.3810
> 3  0.8075 -0.8075  1.0000 NaN -0.2914
> 4     NaN     NaN     NaN NaN     NaN
> 5 -0.3810  0.3810 -0.2914 NaN  1.0000
> Warning message:
> NaNs produced in: sqrt(diag(cov))
> >
> >         # Stable model with skew(ness)=skew.h(b0+b1*day)
> >         # Evaluation at fixed parameter values (since noopt is set to
> TRUE)
> >         print(z5 <- stablereg(y = ret, delta = 1/y[1:49],
> +              loc = ret ~ 1, disp = ~ 1, skew = ~ day, tail = ~ 1,
> +              iloc = 5.557e-04, idisp = -4.957, iskew = c(2.811,-2.158),
> +              itail = -5.261e-1, noopt=T))
> 
> Call:
> stablereg(y = ret, delta = 1/y[1:49], loc = ret ~ 1, disp = ~1,
>     skew = ~day, tail = ~1, iloc = 0.0005557, idisp = -4.957,
>     iskew = c(2.811, -2.158), itail = -0.5261, noopt = T)
> 
> -Log likelihood              150.2681
> No. of obs                   49
> No. of estimated parameters  0
> No. of parameters            5
> Degrees of freedom           49
> AIC                          150.2681
> >
> >         # Stable model with tail=tail.h(b0+b1*day)
> >         print(z6 <- stablereg(y = ret, delta = 1/y[1:49], loc = ret ~ 1,
> +              disp = ~ 1, skew = ~ 1, tail = ~ day, iloc = 0.001,
> +              idisp = -5, iskew = -3, itail = c(2,-7), hessian=F))
> 
> Call:
> stablereg(y = ret, delta = 1/y[1:49], loc = ret ~ 1, disp = ~1,
>     skew = ~1, tail = ~day, iloc = 0.001, idisp = -5, iskew = -3,
>     itail = c(2, -7), hessian = F)
> 
> -Log likelihood              129.4914
> No. of obs                   49
> No. of estimated parameters  5
> No. of parameters            5
> Degrees of freedom           44
> AIC                          134.4914
> Iterations                   83
> 
> Location parameters
> ret ~ 1
>              estimate  se
> (Intercept)  0.001841  NA
> 
> Dispersion parameters
> ~1
>              estimate  se
> (Intercept)    -4.785  NA
> 
> Skew parameters
> ~1
>              estimate  se
> (Intercept)    -13.82  NA
> 
> Tail parameters
> ~day
>              estimate  se
> (Intercept)     1.926  NA
> day            -6.716  NA
> >
> >
> ****************************************************************
> 
> Are those result what they're supposed to be?
> 
> If it is so, I find it confusing that there are NA's, NaN's and/or "Warning:
> no convergence - error 5 "  in practically all results. I took a look at the
> source code and there are 2 messages that give an hint that the result are
> probably ok. It kind of looks like these example are counter example if the
> results are correct that is.
> 
> Is there some documentation for the library, I mean more then the help files
> provide?
> 
> Any help you can provide will be appreciated.
> 
> Thanks.
> 
> Yves Gauvreau
> 
> 
> 
> 
> 

-------------------------------------------------------------------------
from Linux, Jim
-------------------------------------------------------------------------
R : Copyright 1999, The R Development Core Team
Version 0.90.0  (November 22, 1999)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type	"?license" or "?licence" for distribution details.

R is a collaborative project with many contributors.
Type	"?contributors" for a list.

Type	"demo()" for some demos, "help()" for on-line help, or
    	"help.start()" for a HTML browser interface to help.
Type	"q()" to quit R.

> library(stable)
Loading required package: rmutil 
> ## Share return over a 50 day period (see reference above)
> # shares
> y <- c(296,296,300,302,300,304,303,299,293,294,294,293,295,287,288,297,
+ 305,307,307,304,303,304,304,309,309,309,307,306,304,300,296,301,298,
+ 295,295,293,292,297,294,293,306,303,301,303,308,305,302,301,297,299)  
> 
> # returns
> ret <- (y[2:50]-y[1:49])/y[1:49]
> # hist(ret, breaks=seq(-0.035,0.045,0.01))
> 
> day <- seq(0,0.48,by=0.01) # time measured in days/100
> x <- seq(1,length(ret))-1
> 
> # Classic stationary normal model tail=2
> print(z1 <- stablereg(y = ret, delta = 1/y[1:49],
+ 	loc = ~ 1, disp= ~ 1, skew = ~ 1, tail = tail.g(1.9999999),
+ 	iloc = 0, idisp = 0, iskew = 0, otail = F, oskew = F))

Call:
stablereg(y = ret, delta = 1/y[1:49], loc = ~1, disp = ~1, skew = ~1, 
    tail = tail.g(1.9999999), iloc = 0, idisp = 0, iskew = 0, 
    otail = F, oskew = F)

-Log likelihood              136.0479 
No. of obs                   49 
No. of estimated parameters  2 
No. of parameters            4 
Degrees of freedom           47 
AIC                          138.0479 
Iterations                   12 

Location parameters
~1
              estimate        se
(Intercept)  0.0002892  0.001851

Dispersion parameters
~1
             estimate      se
(Intercept)    -4.693  0.1010

Correlations:
          1         2
1 1.0000000 0.0003176
2 0.0003176 1.0000000
> 
> # Normal model (tail=2) with dispersion=disp.h(b0+b1*day)
> print(z2 <- stablereg(y = ret, delta = 1/y[1:49],
+ 	loc = ~ day, disp = ~ 1, skew = ~ 1, tail = tail.g(1.999999),
+ 	iloc = c(0,0), idisp = 0, iskew = 0, oskew = F, otail =F))

Call:
stablereg(y = ret, delta = 1/y[1:49], loc = ~day, disp = ~1, 
    skew = ~1, tail = tail.g(1.999999), iloc = c(0, 0), idisp = 0, 
    iskew = 0, oskew = F, otail = F)

-Log likelihood              135.9994 
No. of obs                   49 
No. of estimated parameters  3 
No. of parameters            5 
Degrees of freedom           46 
AIC                          138.9994 
Iterations                   17 

Location parameters
~day
              estimate        se
(Intercept)   0.001266  0.003643
day          -0.004071  0.013077

Dispersion parameters
~1
             estimate      se
(Intercept)    -4.694  0.1010

Correlations:
          1          2          3
1  1.000000 -0.8615643  0.0009260
2 -0.861564  1.0000000 -0.0009084
3  0.000926 -0.0009084  1.0000000
Warning message: 
NaNs produced in: log(x) 
> 
> # Stable model with loc(ation)=loc.h(b0+b1*day)
> print(z3 <- stablereg(y = ret, delta = 1/y[1:49],
+ 	loc = ~ day, disp = ret ~ 1, skew = ~ 1, tail = ~ 1,
+ 	iloc = c(0.001,0), idisp = 0, iskew = 0, itail = 0))

Call:
stablereg(y = ret, delta = 1/y[1:49], loc = ~day, disp = ret ~ 
    1, skew = ~1, tail = ~1, iloc = c(0.001, 0), idisp = 0, iskew = 0, 
    itail = 0)

Warning: no convergence - error 5 

-Log likelihood              135.921 
No. of obs                   49 
No. of estimated parameters  5 
No. of parameters            5 
Degrees of freedom           44 
AIC                          140.921 
Iterations                   38 

Location parameters
~day
              estimate        se
(Intercept)   0.001297  0.003607
day          -0.004630  0.012963

Dispersion parameters
ret ~ 1
             estimate      se
(Intercept)    -4.704  0.1005

Skew parameters
~1
             estimate     se
(Intercept)     -5.07  41.76

Tail parameters
~1
             estimate   se
(Intercept)     6.408  NaN

Correlations:
          1         2         3         4   5
1  1.000000 -0.860897  0.003654  0.000318 NaN
2 -0.860897  1.000000 -0.003828 -0.002440 NaN
3  0.003654 -0.003828  1.000000 -0.005568 NaN
4  0.000318 -0.002440 -0.005568  1.000000 NaN
5       NaN       NaN       NaN       NaN NaN
Warning message: 
NaNs produced in: sqrt(diag(cov)) 
> 
> # Stable model with disp(ersion)=disp.h(b0+b1*day)
> print(z4 <- stablereg(y = ret, delta = 1/y[1:49],
+ 	loc = ret ~ 1, disp = ~ day, skew = ~ 1, tail = ~ 1,
+ 	iloc = 0, idisp = c(-4.5,0), iskew = -2, itail = 1))

Call:
stablereg(y = ret, delta = 1/y[1:49], loc = ret ~ 1, disp = ~day, 
    skew = ~1, tail = ~1, iloc = 0, idisp = c(-4.5, 0), iskew = -2, 
    itail = 1)

-Log likelihood              132.1774 
No. of obs                   49 
No. of estimated parameters  5 
No. of parameters            5 
Degrees of freedom           44 
AIC                          137.1774 
Iterations                   70 

Location parameters
ret ~ 1
              estimate        se
(Intercept)  0.0009383  0.002394

Dispersion parameters
~day
             estimate      se
(Intercept)   -4.6768  0.2189
day           -0.6556  0.7402

Skew parameters
~1
             estimate     se
(Intercept)    -10.91  59.32

Tail parameters
~1
             estimate      se
(Intercept)    0.6574  0.7444

Correlations:
          1         2         3         4         5
1  1.000000  0.345026  0.185935 -0.001388 -0.600483
2  0.345026  1.000000 -0.735818  0.002904 -0.458313
3  0.185935 -0.735818  1.000000 -0.006449  0.127329
4 -0.001388  0.002904 -0.006449  1.000000 -0.007393
5 -0.600483 -0.458313  0.127329 -0.007393  1.000000
> 
> # Stable model with skew(ness)=skew.h(b0+b1*day)
> # Evaluation at fixed parameter values (since noopt is set to TRUE)
> print(z5 <- stablereg(y = ret, delta = 1/y[1:49],
+ 	loc = ret ~ 1, disp = ~ 1, skew = ~ day, tail = ~ 1,
+ 	iloc = 5.557e-04, idisp = -4.957, iskew = c(2.811,-2.158),
+ 	itail = -5.261e-1, noopt=T))

Call:
stablereg(y = ret, delta = 1/y[1:49], loc = ret ~ 1, disp = ~1, 
    skew = ~day, tail = ~1, iloc = 0.0005557, idisp = -4.957, 
    iskew = c(2.811, -2.158), itail = -0.5261, noopt = T)

-Log likelihood              150.2683 
No. of obs                   49 
No. of estimated parameters  0 
No. of parameters            5 
Degrees of freedom           49 
AIC                          150.2683 
> 
> # Stable model with tail=tail.h(b0+b1*day)
> print(z6 <- stablereg(y = ret, delta = 1/y[1:49], loc = ret ~ 1,
+ 	disp = ~ 1, skew = ~ 1, tail = ~ day, iloc = 0.001,
+ 	idisp = -5, iskew = -3, itail = c(2,-7), hessian=F))

Call:
stablereg(y = ret, delta = 1/y[1:49], loc = ret ~ 1, disp = ~1, 
    skew = ~1, tail = ~day, iloc = 0.001, idisp = -5, iskew = -3, 
    itail = c(2, -7), hessian = F)

Warning: no convergence - error 3 

-Log likelihood              129.4544 
No. of obs                   49 
No. of estimated parameters  5 
No. of parameters            5 
Degrees of freedom           44 
AIC                          134.4544 
Iterations                   70 

Location parameters
ret ~ 1
             estimate  se
(Intercept)  0.001694  NA

Dispersion parameters
~1
             estimate  se
(Intercept)    -4.791  NA

Skew parameters
~1
             estimate  se
(Intercept)    -8.805  NA

Tail parameters
~day
             estimate  se
(Intercept)     2.081  NA
day            -7.091  NA
> 
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list