[R-SIG-Finance] 答复: R-SIG-Finance Digest, Vol 123, Issue 19

王建明 WANGJIANMING888 at pingan.com.cn
Mon Aug 25 12:25:54 CEST 2014


Hi all 
    Here  we  have some  track data recording  driver's moving path which including the speed and direction of a driving journey 
With a  hypothesis  that every single driver has its specific driving habit, we try to draw out the features of a driver and to  judge if an unknown 
Driving  path belonging to a given driver. We try to deal with it by Fourier transformation and wavelets analysis but so for come up with 
No good result.
  is anyone  who has such experience before able to give us some help?  


-----ÓʼþÔ­¼þ-----
·¢¼þÈË: r-sig-finance-bounces at r-project.org [mailto:r-sig-finance-bounces at r-project.org] ´ú±í r-sig-finance-request at r-project.org
·¢ËÍʱ¼ä: 2014Äê8ÔÂ25ÈÕ 18:00
ÊÕ¼þÈË: r-sig-finance at r-project.org
Ö÷Ìâ: R-SIG-Finance Digest, Vol 123, Issue 19

Send R-SIG-Finance mailing list submissions to
	r-sig-finance at r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://stat.ethz.ch/mailman/listinfo/r-sig-finance
or, via email, send a message with subject or body 'help' to
	r-sig-finance-request at r-project.org

You can reach the person managing the list at
	r-sig-finance-owner at r-project.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of R-SIG-Finance digest..."


Today's Topics:

   1. DEoptim and guarantees (was: parma - How to	optimize a
      long/short portfolio with sum( abs( weights )) = 1) (Enrico Schumann)
   2. Re: DEoptim and guarantees (alexios ghalanos)
   3. Implied volatility as external regressors in	rugarch?
      (Milos Cipovic)
   4. Re: Implied volatility as external regressors in rugarch?
      (alexios ghalanos)
   5. Re: DEoptim and guarantees (Enrico Schumann)


----------------------------------------------------------------------

Message: 1
Date: Sun, 24 Aug 2014 20:24:31 +0200
From: Enrico Schumann <es at enricoschumann.net>
To: alexios ghalanos <alexios at 4dscape.com>
Cc: r-sig-finance at r-project.org
Subject: [R-SIG-Finance] DEoptim and guarantees (was: parma - How to
	optimize a long/short portfolio with sum( abs( weights )) = 1)
Message-ID: <877g1xg2zk.fsf at enricoschumann.net>
Content-Type: text/plain; charset=us-ascii

On Fri, 22 Aug 2014, alexios ghalanos <alexios at 4dscape.com> writes:

> 1. DEoptim is a nonlinear global optimization solver. Global 
> optimization is usually reserved for hard to solve non-convex problems 
> with many local minima. There is no guarantee of optimality not even 
> for convex problems, nor any idea of whether the answer you are 
> getting is anything other than a local optimum.

There is no *mathematical* guarantee.  But that does not imply that you cannot use Differential Evolution (the method that DEoptim implements) with confidence.  Just because you cannot prove something does not mean that it is not the case.

You do not need mathematical proofs to make meaningful statements about whether or how well an optimisation method works.[*] For a given model class (such as particular portfolio-selection models), you can run experiments.  Experimental results are no general proof, of course; but they are evidence of how a method performs for that particular type of model, and typically that is all that we care about when we apply a method.  In other words, you may not be able to mathematically prove that a method works, but you can have empirical evidence that is does.

In practical optimisation, it is not useful to think of "the [optimal] solution" to a model, and "all the rest".  An appropriate way to think of it is "no solution, some solution, a better solution, an even better solution, ..."  and so on.  That is, think of "iterative improvement", not of optimisation.


[*] If you need an example other than Differential Evolution for
    that, then look at Nelder--Mead.  You cannot prove anything,
    and yet the method "just works".

--
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net



------------------------------

Message: 2
Date: Sun, 24 Aug 2014 20:06:24 +0100
From: alexios ghalanos <alexios at 4dscape.com>
To: Enrico Schumann <es at enricoschumann.net>
Cc: r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] DEoptim and guarantees
Message-ID: <53FA37B0.5010908 at 4dscape.com>
Content-Type: text/plain; charset=windows-1252

On 24/08/2014 19:24, Enrico Schumann wrote:
> On Fri, 22 Aug 2014, alexios ghalanos <alexios at 4dscape.com> writes:
> 
>> 1. DEoptim is a nonlinear global optimization solver. Global
>> optimization is usually reserved for hard to solve non-convex
>> problems with many local minima. There is no guarantee of
>> optimality not even for convex problems, nor any idea of
>> whether the answer you are getting is anything other than a
>> local optimum.
> 
> There is no *mathematical* guarantee.  But that does not imply
> that you cannot use Differential Evolution (the method that
> DEoptim implements) with confidence.  Just because you cannot
> prove something does not mean that it is not the case.
> 
Accepted, but I'm sure you are not saying that a convex problem which
can be confidently and quickly solved by convex solvers should instead
be solved by differential evolution or other global optimization solvers?

> You do not need mathematical proofs to make meaningful statements
> about whether or how well an optimisation method works.[*] For a
> given model class (such as particular portfolio-selection
> models), you can run experiments.  Experimental results are no
> general proof, of course; but they are evidence of how a method
> performs for that particular type of model, and typically that is
> all that we care about when we apply a method.  In other words,
> you may not be able to mathematically prove that a method works,
> but you can have empirical evidence that is does.
Yes, but if the problem is convex, then there is one solution, and this
can usually be attained quite quickly with specialized convex solvers.
> 
> In practical optimisation, it is not useful to think of "the
> [optimal] solution" to a model, and "all the rest".  An
> appropriate way to think of it is "no solution, some solution, a
> better solution, an even better solution, ..."  and so on.  That
> is, think of "iterative improvement", not of optimisation.
> 
If by "practical optimization" you mean problems which are non-convex or
particularly difficult to solve (e.g. mixed integer), then perhaps. But
for convex problems, there is only one solution (by definition). Whether
that solution turns out to be sub-optimal in the out of sample, that is
down to uncertainty, quality of inputs etc.
However, I have seen a tendency to equate "practical" optimization, with
a simply lazy consideration of an optimization problem without making
the effort to see whether that problem can be put in a convex form.
Plug-and-play, without making some effort to understand the problem is
never, IMHO, a good way to do things.

> 
> [*] If you need an example other than Differential Evolution for
>     that, then look at Nelder--Mead.  You cannot prove anything,
>     and yet the method "just works".
>
Regards,

Alexios



------------------------------

Message: 3
Date: Mon, 25 Aug 2014 05:59:28 +0200
From: Milos Cipovic <pastirs at gmail.com>
To: r-sig-finance at r-project.org
Subject: [R-SIG-Finance] Implied volatility as external regressors in
	rugarch?
Message-ID:
	<CAKoFBbdh8ekO_NMSvGMOwj6a1cH9YNE2Dz4ytB2PTMkzUCuSBw at mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hi there,
I was trying to redo in R excel exercises from Peter F. Christoffersen's
book Elements of Financial Risk Management.

I have different results for problem 3 on page 92 (chapter 4)
You can read it here:

http://books.google.rs/books?id=YkcMBGYbRasC&printsec=frontcover&dq=Elements+of+Financial+Risk+Management&hl=sr&sa=X&ei=K676U6PEJIb6PKWsgZAD&ved=0CBwQ6AEwAA#v=onepage&q&f=false

Here is my R code:


#################################################

library(gdata)
library(rugarch)
#   I downloaded data directly from book's companion site#
data=read.xls("http://booksite.elsevier.com/
               9780123744487/chapter_data_results/
               Chapter4_Results.xls",perl="C:\\Perl64\\bin\\perl.exe",
               sheet=3)
#  where perl="C:\\Perl64\\bin\\perl.exe" is location of pearl.exe file on
my machine,on your's it may differ   #

sandp=as.data.frame(data[,2])

returns=diff(log(sandp))

vix=as.data.frame(data[-1,4])

#scale to one day
ex.reg=(vix^2)/252

spec=ugarchspec(variance.model=list(model="fGARCH",garchOrder=c(1,1),submodel="NAGARCH",
external.regressors=ex.reg),mean.model=list(armaOrder=c(0,0),include.mean=F))

result=(ugarchfit(spec,returns))

coef(result)
likelihood(result)

# If you download excel sheet from
http://booksite.elsevier.com/9780123744487/chapter_data_results/Chapter4_Results.xls
#You'll see the difference in results in maximum likelihoods.
#SO,AM I DOING SOMETHING WRONG OR IS THIS JUST A NUMERICAL ERROR??
#(This may be a amateur question and I apologize for that) but I'm not
shore can I use implied volatility as an external regressor like I did here?

	[[alternative HTML version deleted]]



------------------------------

Message: 4
Date: Mon, 25 Aug 2014 06:06:57 +0100
From: alexios ghalanos <alexios at 4dscape.com>
To: Milos Cipovic <pastirs at gmail.com>, r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] Implied volatility as external regressors
	in rugarch?
Message-ID: <53FAC471.5090003 at 4dscape.com>
Content-Type: text/plain; charset=windows-1252

Milos,

If you notice in his spreadsheet, he is using VIX[t-1] (as it should
be), but you are passing the ex.reg without lagging it (perhaps this
should be made explicit in the documentation).

Pass instead this:

>ex.reg=c(0,(vix^2)/252)

Also, don't pass data frames, use matrix (or xts) for the
external.regressors and numeric for the data (when not using xts).

You'll notice the rugarch likelihood is slightly better and the numbers
very slightly different. If you plug the rugarch coefficients into his
excel spreadsheet you'll get the exact same likelihood.

-Alexios

On 25/08/2014 04:59, Milos Cipovic wrote:
> Hi there,
> I was trying to redo in R excel exercises from Peter F. Christoffersen's
> book Elements of Financial Risk Management.
> 
> I have different results for problem 3 on page 92 (chapter 4)
> You can read it here:
> 
> http://books.google.rs/books?id=YkcMBGYbRasC&printsec=frontcover&dq=Elements+of+Financial+Risk+Management&hl=sr&sa=X&ei=K676U6PEJIb6PKWsgZAD&ved=0CBwQ6AEwAA#v=onepage&q&f=false
> 
> Here is my R code:
> 
> 
> #################################################
> 
> library(gdata)
> library(rugarch)
> #   I downloaded data directly from book's companion site#
> data=read.xls("http://booksite.elsevier.com/
>                9780123744487/chapter_data_results/
>                Chapter4_Results.xls",perl="C:\\Perl64\\bin\\perl.exe",
>                sheet=3)
> #  where perl="C:\\Perl64\\bin\\perl.exe" is location of pearl.exe file on
> my machine,on your's it may differ   #
> 
> sandp=as.data.frame(data[,2])
> 
> returns=diff(log(sandp))
> 
> vix=as.data.frame(data[-1,4])
> 
> #scale to one day
> ex.reg=(vix^2)/252
> 
> spec=ugarchspec(variance.model=list(model="fGARCH",garchOrder=c(1,1),submodel="NAGARCH",
> external.regressors=ex.reg),mean.model=list(armaOrder=c(0,0),include.mean=F))
> 
> result=(ugarchfit(spec,returns))
> 
> coef(result)
> likelihood(result)
> 
> # If you download excel sheet from
> http://booksite.elsevier.com/9780123744487/chapter_data_results/Chapter4_Results.xls
> #You'll see the difference in results in maximum likelihoods.
> #SO,AM I DOING SOMETHING WRONG OR IS THIS JUST A NUMERICAL ERROR??
> #(This may be a amateur question and I apologize for that) but I'm not
> shore can I use implied volatility as an external regressor like I did here?
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
> 
>



------------------------------

Message: 5
Date: Mon, 25 Aug 2014 09:11:25 +0200
From: Enrico Schumann <es at enricoschumann.net>
To: alexios ghalanos <alexios at 4dscape.com>
Cc: r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] DEoptim and guarantees
Message-ID: <8738clqc0y.fsf at enricoschumann.net>
Content-Type: text/plain; charset=us-ascii

On Sun, 24 Aug 2014, alexios ghalanos <alexios at 4dscape.com> writes:

> On 24/08/2014 19:24, Enrico Schumann wrote:
>> On Fri, 22 Aug 2014, alexios ghalanos <alexios at 4dscape.com> writes:
>> 
>>> 1. DEoptim is a nonlinear global optimization solver. Global
>>> optimization is usually reserved for hard to solve non-convex
>>> problems with many local minima. There is no guarantee of
>>> optimality not even for convex problems, nor any idea of
>>> whether the answer you are getting is anything other than a
>>> local optimum.
>> 
>> There is no *mathematical* guarantee.  But that does not imply
>> that you cannot use Differential Evolution (the method that
>> DEoptim implements) with confidence.  Just because you cannot
>> prove something does not mean that it is not the case.
>> 
> Accepted, but I'm sure you are not saying that a convex problem which
> can be confidently and quickly solved by convex solvers should instead
> be solved by differential evolution or other global optimization solvers?

I can think of (and remember) situations in which using a
heuristic is fine, even if one could have used a
more-specialised/more-efficient algorithm.  The key advantage of
a heuristic is flexibility.  Even if a model is convex initially,
it may quickly become non-convex because of a constraint that is
added.  At least in my world, this happens all the time.

>> You do not need mathematical proofs to make meaningful statements
>> about whether or how well an optimisation method works.[*] For a
>> given model class (such as particular portfolio-selection
>> models), you can run experiments.  Experimental results are no
>> general proof, of course; but they are evidence of how a method
>> performs for that particular type of model, and typically that is
>> all that we care about when we apply a method.  In other words,
>> you may not be able to mathematically prove that a method works,
>> but you can have empirical evidence that is does.
>>
> Yes, but if the problem is convex, then there is one solution, and this
> can usually be attained quite quickly with specialized convex solvers.
>> 
>> In practical optimisation, it is not useful to think of "the
>> [optimal] solution" to a model, and "all the rest".  An
>> appropriate way to think of it is "no solution, some solution, a
>> better solution, an even better solution, ..."  and so on.  That
>> is, think of "iterative improvement", not of optimisation.
>> 
> If by "practical optimization" you mean problems which are non-convex or
> particularly difficult to solve (e.g. mixed integer), then perhaps. But
> for convex problems, there is only one solution (by definition). Whether
> that solution turns out to be sub-optimal in the out of sample, that is
> down to uncertainty, quality of inputs etc.

There is one solution to the model.  But with a sensible model, a
solution close to the optimum should be better (in terms of its
objective-function value) than a randomly-chosen solution.  So
the quality of a solution should not be considered either optimal
or non-optimal, but there are "shades of grey", even for convex
problems.  These shades of grey exist just as well in the
out-of-sample period.  This may be hard to square with
optimisation theory, but it makes sense for the application.

> However, I have seen a tendency to equate "practical" optimization, with
> a simply lazy consideration of an optimization problem without making
> the effort to see whether that problem can be put in a convex form.
> Plug-and-play, without making some effort to understand the problem is
> never, IMHO, a good way to do things.

By "practical optimisation" I mean optimisation in which the
results are actually used for financial decision-making, and
hence the results and their interpretation are the main priority.

Practical optimisation is conditional, of course, on having
trustworthy algorithms.  As I said, empirical evidence goes a
long way when it comes to creating trust and confidence.  But
here is my point: an optimisation algorithm is the tool, and once
we have established that the tool works sufficiently well (ie, is
trustworthy), we can stop.  Finding the optimal algorithm is not
the goal in "practical optimisation"; "good enough" is enough.
The actual goal is to find good models.

In my experience, the thing that one often lacks in "practical
optimisation" is time.  I do not mean the time that is saved when
running a faster algorithm, but the time to rewrite code that
works (just to have a more efficient algorithm).

Understanding a model, then, has less to do with how one solves
the model, but with analysing how results change when inputs
change, how results look for different datasets, or how specific
statistical properties of the data affect the results.  Or (to
come back back what I said before) how different in-sample
"shades of grey" relate to out-of-sample results. [For a sensible
model, I would want to see a positive correlation between the
in-sample quality of solutions and their out-of-sample quality.]


>> 
>> [*] If you need an example other than Differential Evolution for
>>     that, then look at Nelder--Mead.  You cannot prove anything,
>>     and yet the method "just works".
>>
> Regards,
>
> Alexios
>

Cheers,
-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net



------------------------------

_______________________________________________
R-SIG-Finance mailing list
R-SIG-Finance at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-finance


End of R-SIG-Finance Digest, Vol 123, Issue 19
**********************************************




********************************************************************************************************************************
The information in this email is confidential and may be legally privileged. If you have received this email in error or are not the intended recipient, please immediately notify the sender and delete this message from your computer. Any use, distribution, or copying of this email other than by the intended recipient is strictly prohibited. All messages sent to and from us may be monitored to ensure compliance with internal policies and to protect our business. 
Emails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, lost or destroyed, or contain viruses. Anyone who communicates with us by email is taken to accept these risks. 

收发邮件者请注意:
本邮件含保密信息,若误收本邮件,请务必通知发送人并直接删去,不得使用、传播或复制本邮件。
进出邮件均受到本公司合规监控。邮件可能发生被截留、被修改、丢失、被破坏或包含计算机病毒等不安全情况。 
********************************************************************************************************************************


More information about the R-SIG-Finance mailing list