Re: [R] Skewed t distribution

2006-03-29 Thread Konrad Banachewicz
On 3/28/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:

 You need to learn to supply adequate information.  The current
 version of sn *does* have such an argument, and I was careful to check.
 So it seems that you are using an unstated obselete version of sn.
 Do ugrade as the posting guide asked you to.


 Ok, point taken, I just forgot about it and had no way to do it
before computations started (I have to work on two machines,
and the one with R on it has no access to the internet).
My apologies for wasting Your  everyone else's time.

rg,
konrad

--
 We are what we pretend to be, so we must be careful about what we pretend
 to be

   Kurt Vonnegut Jr. Mother Night

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Skewed t distribution

2006-03-28 Thread Konrad Banachewicz
Dear All,
I am working with skewed-t copula in my research recently, so I needed to
write an mle
procedure instead of using a standard fit one; I stick to the sn package. On
subsamples of the entire population that I deal with, everything is fine.
However, on the total sample (difference in cross-sectional
dimension: 30 vs 240) things go wrong - the objective function diverges to
infinity. I located the rotten line
to be

t1 - dmst(vector, mu, P, alpha, nu)

where vector is the matrix row, on which I evaluate my likelihood and the
rest in parametrized in a standard
way, just as the help pages give it. In large dimensions, I get a zero value
of the density (which is probably due to numerical issues). I tried the
following dummy example

t1 - rmst(1,mu,P,alpha, nu)
t2 - dmst(t1, mu, alpha,nu)

and t2 remains to be zero. Can anyone help me on this one?

thanks in advance,
Konrad

--
We are what we pretend to be, so we must be careful about what we pretend
to be

  Kurt Vonnegut Jr. Mother Night

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Skewed t distribution

2006-03-28 Thread Prof Brian Ripley
Try maximizing the log-likelihood and using the log=TRUE argument to dmst.

(You have told us so little about what you are doing that we can but guess 
at what you mean by `write an mle procedure': what is wrong with st.mle, 
for example?)

On Tue, 28 Mar 2006, Konrad Banachewicz wrote:

 Dear All,
 I am working with skewed-t copula in my research recently, so I needed to
 write an mle
 procedure instead of using a standard fit one; I stick to the sn package. On
 subsamples of the entire population that I deal with, everything is fine.
 However, on the total sample (difference in cross-sectional
 dimension: 30 vs 240) things go wrong - the objective function diverges to
 infinity. I located the rotten line
 to be

 t1 - dmst(vector, mu, P, alpha, nu)

 where vector is the matrix row, on which I evaluate my likelihood and the
 rest in parametrized in a standard
 way, just as the help pages give it. In large dimensions, I get a zero value
 of the density (which is probably due to numerical issues). I tried the
 following dummy example

 t1 - rmst(1,mu,P,alpha, nu)
 t2 - dmst(t1, mu, alpha,nu)

 and t2 remains to be zero. Can anyone help me on this one?

 thanks in advance,
 Konrad

 --
 We are what we pretend to be, so we must be careful about what we pretend
 to be

  Kurt Vonnegut Jr. Mother Night

   [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Skewed t distribution

2006-03-28 Thread Adelchi Azzalini
On Tue, 28 Mar 2006 11:41:19 +0200, Konrad Banachewicz wrote:

please supply the ingredients needed to reproduce the problem that
you have faced (including the values of the parameters mu,P,alpha,nu,
among the rest)

best wishes,

Adelchi Azzalini


KB Dear All,
KB I am working with skewed-t copula in my research recently, so I
KB needed to write an mle
KB procedure instead of using a standard fit one; I stick to the sn
KB package. On subsamples of the entire population that I deal with,
KB everything is fine. However, on the total sample (difference in
KB cross-sectional dimension: 30 vs 240) things go wrong - the
KB objective function diverges to infinity. I located the rotten
KB line to be
KB 
KB t1 - dmst(vector, mu, P, alpha, nu)
KB 
KB where vector is the matrix row, on which I evaluate my
KB likelihood and the rest in parametrized in a standard
KB way, just as the help pages give it. In large dimensions, I get a
KB zero value of the density (which is probably due to numerical
KB issues). I tried the following dummy example
KB 
KB t1 - rmst(1,mu,P,alpha, nu)
KB t2 - dmst(t1, mu, alpha,nu)
KB 
KB and t2 remains to be zero. Can anyone help me on this one?
KB 
KB thanks in advance,
KB Konrad
KB 
KB --
KB We are what we pretend to be, so we must be careful about what we
KB pretend to be
KB 
KB   Kurt Vonnegut Jr. Mother Night
KB 
KB [[alternative HTML version deleted]]
KB 
KB __
KB R-help@stat.math.ethz.ch mailing list
KB https://stat.ethz.ch/mailman/listinfo/r-help
KB PLEASE do read the posting guide!
KB http://www.R-project.org/posting-guide.html
KB

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Skewed t distribution

2006-03-28 Thread Konrad Banachewicz
On 3/28/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:

 Try maximizing the log-likelihood and using the log=TRUE argument to dmst.


seems like dmst does not support this argument (the way e.g. dt does)



 (You have told us so little about what you are doing that we can but guess
 at what you mean by `write an mle procedure': what is wrong with st.mle,
 for example?)


st.mle assumes skewed-t marginals (for a whole distribution), whereas
I am working with a copula so my margins are uniform. The whole point
is separating the joint and marginal dynamics.

rg,
konrad

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Skewed t distribution

2006-03-28 Thread Konrad Banachewicz
P is an identity matrix 240X240, mu and alpha are vectors of zeros
240X1, nu equals 10, so alltogether You need:
P - matrix(0,244,244)
diag(P) - 1
nu - 10
alpha - rep(0,244)
mu - rep(0,244)
require(sn)
t1 - rmst(1,mu,P, alpha, nu)
t2 - dmst(t1,mu,P,alpha,nu)




 please supply the ingredients needed to reproduce the problem that
 you have faced (including the values of the parameters mu,P,alpha,nu,
 among the rest)

 best wishes,

 Adelchi Azzalini



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Skewed t distribution

2006-03-28 Thread Prof Brian Ripley
You need to learn to supply adequate information.  The current 
version of sn *does* have such an argument, and I was careful to check.
So it seems that you are using an unstated obselete version of sn.
Do ugrade as the posting guide asked you to.

On Tue, 28 Mar 2006, Konrad Banachewicz wrote:

 On 3/28/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:

 Try maximizing the log-likelihood and using the log=TRUE argument to dmst.


 seems like dmst does not support this argument (the way e.g. dt does)



 (You have told us so little about what you are doing that we can but guess
 at what you mean by `write an mle procedure': what is wrong with st.mle,
 for example?)


 st.mle assumes skewed-t marginals (for a whole distribution), whereas
 I am working with a copula so my margins are uniform. The whole point
 is separating the joint and marginal dynamics.

 rg,
 konrad


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Skewed t distribution

2006-03-28 Thread Adelchi Azzalini
On Tue, 28 Mar 2006 13:11:02 +0200, Konrad Banachewicz wrote:

KB P is an identity matrix 240X240, mu and alpha are vectors of zeros
KB 240X1, nu equals 10, so alltogether You need:
KB P - matrix(0,244,244)
KB diag(P) - 1
KB nu - 10
KB alpha - rep(0,244)
KB mu - rep(0,244)
KB require(sn)
KB t1 - rmst(1,mu,P, alpha, nu)
KB t2 - dmst(t1,mu,P,alpha,nu)
KB 
KB 

With such a large dimension, numerical problems are obiquitous.
At the very least, I suggest that you work on the log scale:

R t2 - dmst(t1,mu,P,alpha,nu, log=TRUE)
R t2
[1] -250.3
R exp(t2)
[1] 2.002e-109


The next release of the 'sn' package will handle this sort of things
in a more consisent way (the R code is largely updated, but the
documentation is far behind..)



-- 
Adelchi Azzalini  [EMAIL PROTECTED]
Dipart.Scienze Statistiche, Università di Padova, Italia
tel. +39 049 8274147,  http://azzalini.stat.unipd.it/


KB 
KB 
KB  please supply the ingredients needed to reproduce the problem
KB  that you have faced (including the values of the parameters
KB  mu,P,alpha,nu, among the rest)
KB 
KB  best wishes,
KB 
KB  Adelchi Azzalini
KB 
KB 
KB

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Skewed t distribution

2006-03-28 Thread Adelchi Azzalini
On Tue, 28 Mar 2006 12:59:34 +0200, Konrad Banachewicz wrote:

KB On 3/28/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:
KB 
KB  Try maximizing the log-likelihood and using the log=TRUE
KB  argument to dmst.
KB 
KB 
KB seems like dmst does not support this argument (the way e.g. dt
KB does)
KB 

here I get the following

R library(sn)
Loading required package: mvtnorm
Library 'sn', version  0.3-5 (2005-12-30) , © 1998-2005 A.Azzalini
type 'help(SN)' for summary information
R args(dmst)
function (x, xi = rep(0, d), Omega, alpha, df = Inf, log = FALSE) 
NULL
R 

notice that 0.3-5 is the current version on CRAN

KB 
KB 
KB  (You have told us so little about what you are doing that we can
KB  but guess at what you mean by `write an mle procedure': what is
KB  wrong with st.mle, for example?)
KB 
KB 
KB st.mle assumes skewed-t marginals (for a whole distribution),
KB whereas I am working with a copula so my margins are uniform. The
KB whole point is separating the joint and marginal dynamics.
KB 

I am not a copula expert, but what Brian Ripley suggests makes sense 
to me; and I know of people that have used st.mle to obtain the
marginal components (which is what is needed for the copula mechanism)




-- 
Adelchi Azzalini  [EMAIL PROTECTED]
Dipart.Scienze Statistiche, Università di Padova, Italia
tel. +39 049 8274147,  http://azzalini.stat.unipd.it/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html