[R-SIG-Finance] issue on data import to pgAdminIII

2012-05-02 Thread krisan haria
Hi

I trying to use the function dbWriteTable to write data from R into
pgAdminIII

The table is called price and the column within in price is called
pricelevel

The connection works fine and when I call dbExistsTable(con, price) I get
true so, so far so good.

However, when I call the function as

dbWriteTable(con, name=price, value=df,
field.types=list(pricelevel=double(20)), row.names=FALSE)

I get the error

Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function dbWriteTable, for
signature PostgreSQLConnection, character, missing

Any idea on what I'm doing wrong?

The version of R is 2.13.1

Regards

Krisan

[[alternative HTML version deleted]]

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] issue on data import to pgAdminIII

2012-05-02 Thread Brian G. Peterson
On Wed, 2012-05-02 at 09:46 +0100, krisan haria wrote:
 
 I trying to use the function dbWriteTable to write data from R into
 pgAdminIII
 
 The table is called price and the column within in price is called
 pricelevel

While you may be trying to use the database to do finance, this question
has nothing to do with finance.

 Any idea on what I'm doing wrong?

1 you posted to the wrong mailing list.
R-SIG-DB or R-Help would have been more appropriate.

2 You did not follow the Posting guide:
http://www.r-project.org/posting-guide.html

3 (sub of 2)  you did not provide a minimal reproducible example

 The version of R is 2.13.1 

4 you're using a very old version of R

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock

___
R-SIG-Finance@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.


[R-SIG-Finance] Back test report in Rugarch

2012-05-02 Thread Papa sen
Dear all,
Please I did backtesting using rugarch and got the following. Finding it 
difficult to make sense of out of the result.
Please any help would be appreciated. I need some few comments.  Also it 
appears that the backtest length does not change (i may be wrong)Find the 
output below:
VaR Backtest Report 
=== 
Model:  fGARCH-std 
Backtest Length:    500 
Data:    
== 
alpha:  1% 
Expected Exceed:    5 
Actual VaR Exceed:  4 
Actual %:   0.8%
Unconditional Coverage (Kupiec) 
Null-Hypothesis:    Correct Exceedances 
LR.uc Statistic:    0.217 
LR.uc Critical: 3.841 
LR.uc p-value:  0.641 
Reject Null:    NO
Conditional Coverage (Christoffersen) 
Null-Hypothesis:    Correct Exceedances  
    Independence of Failures 
LR.cc Statistic:    0.282 
LR.cc Critical: 5.991 
LR.cc p-value:  0.869 
Reject Null:    NO
kind regards,
paps 
[[alternative HTML version deleted]]

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] quantstrat with intraday data

2012-05-02 Thread Brian G. Peterson
On Wed, 2012-05-02 at 00:00 -0400, Jim Green wrote:
 Greetings!
 Pls forgive me if this is an old topic. I have searched through list
 archives extensively but I am just not sure if I am using quantstrat
 correctly with intraday data.
...
 Currently I use something similar to attached test.R to do intraday
 work. in the code I liquidate everything before close so that I don't
 need to worry about splits and dividends. Is what I am doing the
 correct way of using quantstrat with intraday data?

That's certainly the easiest answer.

blotter contains some support for dividends, but it is only lightly
tested, since I personally don't need that functionality.  Additional
testing, direct feedback, and patches are always welcome.  Participation
by users is one of the ways these packages grow over time.  (and feel
free to take those conversations off-list)

 Also if in future I will hold overnight positions, How would I make
 sure dividends and splits are correctly adjusted for pnl and summary
 statistics? would underlying blotter be smart enough to handle all the
 housekeeping?

No Guarantees (of course that's true of everything in R).

My recollection is that the addDiv function will add cash to your
account to cover dividends.  

I don't believe that there is a function for splits.  You'd likely need
to write that, we'd love the contribution.  It shouldn't be hard, as all
that needs to happen is that you add a transaction for the split with a
price of zero, adding more shares and lowering your average cost to
compensate for the split.

As xts gains support for differing column classes this summer as part of
the funded GSoC project, it will get easier to add additional
information to transactions that will definitely include transaction
type.

Regards,

   - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Back test report in Rugarch

2012-05-02 Thread John Kerpel
Are you using the ugarchroll method?  Show some code...

On Wed, May 2, 2012 at 7:03 AM, Papa sen papa.se...@yahoo.it wrote:

 Dear all,
 Please I did backtesting using rugarch and got the following. Finding it
 difficult to make sense of out of the result.
 Please any help would be appreciated. I need some few comments.  Also it
 appears that the backtest length does not change (i may be wrong)Find the
 output below:
 VaR Backtest Report
 ===
 Model:  fGARCH-std
 Backtest Length:500
 Data:
 ==
 alpha:  1%
 Expected Exceed:5
 Actual VaR Exceed:  4
 Actual %:   0.8%
 Unconditional Coverage (Kupiec)
 Null-Hypothesis:Correct Exceedances
 LR.uc Statistic:0.217
 LR.uc Critical: 3.841
 LR.uc p-value:  0.641
 Reject Null:NO
 Conditional Coverage (Christoffersen)
 Null-Hypothesis:Correct Exceedances 
 Independence of Failures
 LR.cc Statistic:0.282
 LR.cc Critical: 5.991
 LR.cc p-value:  0.869
 Reject Null:NO
 kind regards,
 paps
[[alternative HTML version deleted]]


 ___
 R-SIG-Finance@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.


[[alternative HTML version deleted]]

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Back test report in Rugarch

2012-05-02 Thread Papa sen
Please find some sample codes:
 rollD = ugarchroll(spec4, data = as.numeric(ret), n.ahead = 1, forecast.length 
= 500,
 refit.every = 25, refit.window = recursive, parallel = TRUE,
 parallel.control = list(pkg = snowfall, cores = 10), solver = solnp,
 solver.control = list(tol = 1e-05, delta = 1e-06, trace = 0),
 calculate.VaR = TRUE, VaR.alpha = c(0.010, 0.05))

report(rollD, type = VaR, n.ahead = 1, VaR.alpha = 0.01, conf.level = 0.95)
report(rollD, type=fpm)




 Da: John Kerpel john.ker...@gmail.com

Cc: r-sig-finance@r-project.org r-sig-finance@r-project.org 
Inviato: Mercoledì 2 Maggio 2012 15:09
Oggetto: Re: [R-SIG-Finance] Back test report in Rugarch


Are you using the ugarchroll method?  Show some code...




Dear all,
Please I did backtesting using rugarch and got the following. Finding it 
difficult to make sense of out of the result.
Please any help would be appreciated. I need some few comments.  Also it 
appears that the backtest length does not change (i may be wrong)Find the 
output below:
VaR Backtest Report
===
Model:  fGARCH-std
Backtest Length:    500
Data:   
==
alpha:  1%
Expected Exceed:    5
Actual VaR Exceed:  4
Actual %:   0.8%
Unconditional Coverage (Kupiec)
Null-Hypothesis:    Correct Exceedances
LR.uc Statistic:    0.217
LR.uc Critical: 3.841
LR.uc p-value:  0.641
Reject Null:    NO
Conditional Coverage (Christoffersen)
Null-Hypothesis:    Correct Exceedances 
    Independence of Failures
LR.cc Statistic:    0.282
LR.cc Critical: 5.991
LR.cc p-value:  0.869
Reject Null:    NO
kind regards,
paps
       [[alternative HTML version deleted]]


___
R-SIG-Finance@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.

[[alternative HTML version deleted]]

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] Back test report in Rugarch

2012-05-02 Thread alexios ghalanos
What are you having trouble understanding? The Null Hypothesis is 
clearly stated and the test also provides the 'decision' on whether to 
reject the Null at the given confidence level.
Type ?VaRTest if you want a more detailed description of what each 
parameter means, or read the vignette for a description of what the test 
does with the literature reference.
As to the backtest length not changing, you do not state under which 
circumstances you experienced such as an error. From your code you 
requested a forecast length of 500 which is what you got in the 
resulting output.


-Alexios

On 02/05/2012 14:25, Papa sen wrote:

Please find some sample codes:
  rollD = ugarchroll(spec4, data = as.numeric(ret), n.ahead = 1, 
forecast.length = 500,
  refit.every = 25, refit.window = recursive, parallel = TRUE,
  parallel.control = list(pkg = snowfall, cores = 10), solver = solnp,
  solver.control = list(tol = 1e-05, delta = 1e-06, trace = 0),
  calculate.VaR = TRUE, VaR.alpha = c(0.010, 0.05))

report(rollD, type = VaR, n.ahead = 1, VaR.alpha = 0.01, conf.level = 0.95)
report(rollD, type=fpm)




  Da: John Kerpeljohn.ker...@gmail.com

Cc: r-sig-finance@r-project.orgr-sig-finance@r-project.org
Inviato: Mercoledì 2 Maggio 2012 15:09
Oggetto: Re: [R-SIG-Finance] Back test report in Rugarch


Are you using the ugarchroll method?  Show some code...




Dear all,

Please I did backtesting using rugarch and got the following. Finding it 
difficult to make sense of out of the result.
Please any help would be appreciated. I need some few comments.  Also it 
appears that the backtest length does not change (i may be wrong)Find the 
output below:
VaR Backtest Report
===
Model:  fGARCH-std
Backtest Length:500
Data:
==
alpha:  1%
Expected Exceed:5
Actual VaR Exceed:  4
Actual %:   0.8%
Unconditional Coverage (Kupiec)
Null-Hypothesis:Correct Exceedances
LR.uc Statistic:0.217
LR.uc Critical: 3.841
LR.uc p-value:  0.641
Reject Null:NO
Conditional Coverage (Christoffersen)
Null-Hypothesis:Correct Exceedances
 Independence of Failures
LR.cc Statistic:0.282
LR.cc Critical: 5.991
LR.cc p-value:  0.869
Reject Null:NO
kind regards,
paps
[[alternative HTML version deleted]]


___
R-SIG-Finance@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.


[[alternative HTML version deleted]]




___
R-SIG-Finance@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.


___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Back test report in Rugarch

2012-05-02 Thread John Kerpel
It looks like you got what you requested - 500 1 step ahead forecasts with
a VaR Test that seems to fit the data well.  Check the literature for the
defintions of the VaR Tests from Christoffersen/Kupiec et al.

On Wed, May 2, 2012 at 8:25 AM, Papa sen papa.se...@yahoo.it wrote:

 Please find some sample codes:
  rollD = ugarchroll(spec4, data = as.numeric(ret), n.ahead = 1,
 forecast.length = 500,
  refit.every = 25, refit.window = recursive, parallel = TRUE,
  parallel.control = list(pkg = snowfall, cores = 10), solver = solnp,
  solver.control = list(tol = 1e-05, delta = 1e-06, trace = 0),
  calculate.VaR = TRUE, VaR.alpha = c(0.010, 0.05))

 report(rollD, type = VaR, n.ahead = 1, VaR.alpha = 0.01, conf.level =
 0.95)
 report(rollD, type=fpm)


   --
 *Da:* John Kerpel john.ker...@gmail.com
 *A:* Papa sen papa.se...@yahoo.it
 *Cc:* r-sig-finance@r-project.org r-sig-finance@r-project.org
 *Inviato:* Mercoledì 2 Maggio 2012 15:09
 *Oggetto:* Re: [R-SIG-Finance] Back test report in Rugarch

 Are you using the ugarchroll method?  Show some code...

 On Wed, May 2, 2012 at 7:03 AM, Papa sen papa.se...@yahoo.it wrote:

 Dear all,
 Please I did backtesting using rugarch and got the following. Finding it
 difficult to make sense of out of the result.
 Please any help would be appreciated. I need some few comments.  Also it
 appears that the backtest length does not change (i may be wrong)Find the
 output below:
 VaR Backtest Report
 ===
 Model:  fGARCH-std
 Backtest Length:500
 Data:
 ==
 alpha:  1%
 Expected Exceed:5
 Actual VaR Exceed:  4
 Actual %:   0.8%
 Unconditional Coverage (Kupiec)
 Null-Hypothesis:Correct Exceedances
 LR.uc Statistic:0.217
 LR.uc Critical: 3.841
 LR.uc p-value:  0.641
 Reject Null:NO
 Conditional Coverage (Christoffersen)
 Null-Hypothesis:Correct Exceedances 
 Independence of Failures
 LR.cc Statistic:0.282
 LR.cc Critical: 5.991
 LR.cc p-value:  0.869
 Reject Null:NO
 kind regards,
 paps
[[alternative HTML version deleted]]


 ___
 R-SIG-Finance@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.






[[alternative HTML version deleted]]

___
R-SIG-Finance@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.

Re: [R-SIG-Finance] Back test report in Rugarch

2012-05-02 Thread Brian G. Peterson
On Wed, 2012-05-02 at 15:35 +0100, Papa sen wrote:
 Thanks so much for your comments. However, Alexios, I used the same
 codes and changed the backtest length =875 and yet got a report of 500
 to be the backtest length.

without more information, I don't think we know how long your series
is  There is a certain minimum amount of data to make the model.

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Back test report in Rugarch

2012-05-02 Thread alexios ghalanos

Have you checked your data and code carefully?
e.g. Does your data have 975+ points (875 for forecast and 100 for 
initializing the rolling estimation)?


I can't replicate your error and it is likely that you have forgotten 
something:


library(rugarch)
data(sp500ret)
spec=ugarchspec()
rollD2 = ugarchroll(spec, data = as.numeric(sp500ret[1:975,1]), n.ahead 
= 1, forecast.length = 875,

refit.every = 25, refit.window = recursive, parallel = TRUE,
parallel.control = list(pkg = snowfall, cores = 10), solver = solnp,
solver.control = list(tol = 1e-05, delta = 1e-06, trace = 0),
calculate.VaR = TRUE, VaR.alpha = c(0.010, 0.05))

report(rollD2, type = VaR, n.ahead = 1, VaR.alpha = 0.01, conf.level = 
0.95)


Backtest Length:875


Please check your code VERY carefully before submitting.

-Alexios



On 02/05/2012 15:35, Papa sen wrote:

Dear alexios and kerpel,
Thanks so much for your comments. However, Alexios, I used the same
codes and changed the backtest length =875 and yet got a report of 500
to be the backtest length.
Kind regards,
p.s


*Da:* alexios ghalanos alex...@4dscape.com
*A:* Papa sen papa.se...@yahoo.it
*Cc:* r-sig-finance@r-project.org r-sig-finance@r-project.org
*Inviato:* Mercoledì 2 Maggio 2012 15:49
*Oggetto:* Re: [R-SIG-Finance] Back test report in Rugarch

What are you having trouble understanding? The Null Hypothesis is
clearly stated and the test also provides the 'decision' on whether to
reject the Null at the given confidence level.
Type ?VaRTest if you want a more detailed description of what each
parameter means, or read the vignette for a description of what the test
does with the literature reference.
As to the backtest length not changing, you do not state under which
circumstances you experienced such as an error. From your code you
requested a forecast length of 500 which is what you got in the
resulting output.

-Alexios

On 02/05/2012 14:25, Papa sen wrote:
  Please find some sample codes:
  rollD = ugarchroll(spec4, data = as.numeric(ret), n.ahead = 1,
forecast.length = 500,
  refit.every = 25, refit.window = recursive, parallel = TRUE,
  parallel.control = list(pkg = snowfall, cores = 10), solver = solnp,
  solver.control = list(tol = 1e-05, delta = 1e-06, trace = 0),
  calculate.VaR = TRUE, VaR.alpha = c(0.010, 0.05))
 
  report(rollD, type = VaR, n.ahead = 1, VaR.alpha = 0.01, conf.level
= 0.95)
  report(rollD, type=fpm)
 
 
 
  
  Da: John Kerpeljohn.ker...@gmail.com mailto:john.ker...@gmail.com
 
  Cc: r-sig-finance@r-project.org
mailto:r-sig-finance@r-project.orgr-sig-finance@r-project.org
mailto:r-sig-finance@r-project.org
  Inviato: Mercoledì 2 Maggio 2012 15:09
  Oggetto: Re: [R-SIG-Finance] Back test report in Rugarch
 
 
  Are you using the ugarchroll method? Show some code...
 
 
 
 
  Dear all,
  Please I did backtesting using rugarch and got the following.
Finding it difficult to make sense of out of the result.
  Please any help would be appreciated. I need some few comments. Also
it appears that the backtest length does not change (i may be wrong)Find
the output below:
  VaR Backtest Report
  ===
  Model: fGARCH-std
  Backtest Length: 500
  Data:
  ==
  alpha: 1%
  Expected Exceed: 5
  Actual VaR Exceed: 4
  Actual %: 0.8%
  Unconditional Coverage (Kupiec)
  Null-Hypothesis: Correct Exceedances
  LR.uc Statistic: 0.217
  LR.uc Critical: 3.841
  LR.uc p-value: 0.641
  Reject Null: NO
  Conditional Coverage (Christoffersen)
  Null-Hypothesis: Correct Exceedances
  Independence of Failures
  LR.cc Statistic: 0.282
  LR.cc Critical: 5.991
  LR.cc p-value: 0.869
  Reject Null: NO
  kind regards,
  paps
  [[alternative HTML version deleted]]
 
 
  ___
  R-SIG-Finance@r-project.org mailto:R-SIG-Finance@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.
 
  [[alternative HTML version deleted]]
 
 
 
 
  ___
  R-SIG-Finance@r-project.org mailto:R-SIG-Finance@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.





___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Back test report in Rugarch

2012-05-02 Thread Papa sen
my data has 875 points


 Da: alexios ghalanos alex...@4dscape.com

Cc: r-sig-finance@r-project.org r-sig-finance@r-project.org 
Inviato: Mercoledì 2 Maggio 2012 16:51
Oggetto: Re: [R-SIG-Finance] Back test report in Rugarch

Have you checked your data and code carefully?
e.g. Does your data have 975+ points (875 for forecast and 100 for 
initializing the rolling estimation)?

I can't replicate your error and it is likely that you have forgotten 
something:

library(rugarch)
data(sp500ret)
spec=ugarchspec()
rollD2 = ugarchroll(spec, data = as.numeric(sp500ret[1:975,1]), n.ahead
= 1, forecast.length = 875,
refit.every = 25, refit.window = recursive, parallel = TRUE,
parallel.control = list(pkg = snowfall, cores = 10), solver = solnp,
solver.control = list(tol = 1e-05, delta = 1e-06, trace = 0),
calculate.VaR = TRUE, VaR.alpha = c(0.010, 0.05))

report(rollD2, type = VaR, n.ahead = 1, VaR.alpha = 0.01, conf.level = 
0.95)

Backtest Length:        875


Please check your code VERY carefully before submitting.

-Alexios



On 02/05/2012 15:35, Papa sen wrote:
 Dear alexios and kerpel,
 Thanks so much for your comments. However, Alexios, I used the same
 codes and changed the backtest length =875 and yet got a report of 500
 to be the backtest length.
 Kind regards,
 p.s

 
 *Da:* alexios ghalanos alex...@4dscape.com

 *Cc:* r-sig-finance@r-project.org r-sig-finance@r-project.org
 *Inviato:* Mercoledì 2 Maggio 2012 15:49
 *Oggetto:* Re: [R-SIG-Finance] Back test report in Rugarch

 What are you having trouble understanding? The Null Hypothesis is
 clearly stated and the test also provides the 'decision' on whether to
 reject the Null at the given confidence level.
 Type ?VaRTest if you want a more detailed description of what each
 parameter means, or read the vignette for a description of what the test
 does with the literature reference.
 As to the backtest length not changing, you do not state under which
 circumstances you experienced such as an error. From your code you
 requested a forecast length of 500 which is what you got in the
 resulting output.

 -Alexios

 On 02/05/2012 14:25, Papa sen wrote:
   Please find some sample codes:
   rollD = ugarchroll(spec4, data = as.numeric(ret), n.ahead = 1,
 forecast.length = 500,
   refit.every = 25, refit.window = recursive, parallel = TRUE,
   parallel.control = list(pkg = snowfall, cores = 10), solver = solnp,
   solver.control = list(tol = 1e-05, delta = 1e-06, trace = 0),
   calculate.VaR = TRUE, VaR.alpha = c(0.010, 0.05))
  
   report(rollD, type = VaR, n.ahead = 1, VaR.alpha = 0.01, conf.level
 = 0.95)
   report(rollD, type=fpm)
  
  
  
   
   Da: John Kerpeljohn.ker...@gmail.com mailto:john.ker...@gmail.com
  
   Cc: r-sig-finance@r-project.org
 mailto:r-sig-finance@r-project.orgr-sig-finance@r-project.org
 mailto:r-sig-finance@r-project.org
   Inviato: Mercoledì 2 Maggio 2012 15:09
   Oggetto: Re: [R-SIG-Finance] Back test report in Rugarch
  
  
   Are you using the ugarchroll method? Show some code...
  
  
  
  
   Dear all,
   Please I did backtesting using rugarch and got the following.
 Finding it difficult to make sense of out of the result.
   Please any help would be appreciated. I need some few comments. Also
 it appears that the backtest length does not change (i may be wrong)Find
 the output below:
   VaR Backtest Report
   ===
   Model: fGARCH-std
   Backtest Length: 500
   Data:
   ==
   alpha: 1%
   Expected Exceed: 5
   Actual VaR Exceed: 4
   Actual %: 0.8%
   Unconditional Coverage (Kupiec)
   Null-Hypothesis: Correct Exceedances
   LR.uc Statistic: 0.217
   LR.uc Critical: 3.841
   LR.uc p-value: 0.641
   Reject Null: NO
   Conditional Coverage (Christoffersen)
   Null-Hypothesis: Correct Exceedances
   Independence of Failures
   LR.cc Statistic: 0.282
   LR.cc Critical: 5.991
   LR.cc p-value: 0.869
   Reject Null: NO
   kind regards,
   paps
   [[alternative HTML version deleted]]
  
  
   ___
   R-SIG-Finance@r-project.org mailto:R-SIG-Finance@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.
  
   [[alternative HTML version deleted]]
  
  
  
  
   ___
   R-SIG-Finance@r-project.org mailto:R-SIG-Finance@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.



[[alternative HTML version 

Re: [R-SIG-Finance] quantstrat with intraday data

2012-05-02 Thread G See
As an alternative to adjusting for dividends in quantstrat or blotter,
my qmao package (https://r-forge.r-project.org/R/?group_id=1113) has
two functions that adjust intraday data for dividends.

`adjustIntraday.yahoo` will download dividend data from yahoo and
calculate daily ratios.  Those ratios will then be applied to intraday
data.

`AddCumDiv` simply adds back all dividends to the price series.

With adjustIntraday.yahoo, the most recent observations will be the
same as the unadjusted data, but the older observations will be lower
than those that are unadjusted.

With AddCumDiv, the oldest observations will be the same for the
adjusted and unadjusted data, but the most recent observations will be
higher for AddCumDiv.

Although I believe these functions work like they're supposed to, they
have not been rigorously tested, so YMMV.  bug reports encouraged.

Since I just committed the AddCumDiv function a few minutes ago, it is
not yet in the R-Forge build (although it is in the repo if you know
how to svn checkout).  Since it's not in the build yet, I attached it.

Regards,
Garrett

On Wed, May 2, 2012 at 8:02 AM, Brian G. Peterson br...@braverock.com wrote:
 On Wed, 2012-05-02 at 00:00 -0400, Jim Green wrote:
 Greetings!
 Pls forgive me if this is an old topic. I have searched through list
 archives extensively but I am just not sure if I am using quantstrat
 correctly with intraday data.
 ...
 Currently I use something similar to attached test.R to do intraday
 work. in the code I liquidate everything before close so that I don't
 need to worry about splits and dividends. Is what I am doing the
 correct way of using quantstrat with intraday data?

 That's certainly the easiest answer.

 blotter contains some support for dividends, but it is only lightly
 tested, since I personally don't need that functionality.  Additional
 testing, direct feedback, and patches are always welcome.  Participation
 by users is one of the ways these packages grow over time.  (and feel
 free to take those conversations off-list)

 Also if in future I will hold overnight positions, How would I make
 sure dividends and splits are correctly adjusted for pnl and summary
 statistics? would underlying blotter be smart enough to handle all the
 housekeeping?

 No Guarantees (of course that's true of everything in R).

 My recollection is that the addDiv function will add cash to your
 account to cover dividends.

 I don't believe that there is a function for splits.  You'd likely need
 to write that, we'd love the contribution.  It shouldn't be hard, as all
 that needs to happen is that you add a transaction for the split with a
 price of zero, adding more shares and lowering your average cost to
 compensate for the split.

 As xts gains support for differing column classes this summer as part of
 the funded GSoC project, it will get easier to add additional
 information to transactions that will definitely include transaction
 type.

 Regards,

   - Brian

 --
 Brian G. Peterson
 http://braverock.com/brian/
 Ph: 773-459-4973
 IM: bgpbraverock

 ___
 R-SIG-Finance@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.


AddCumDiv.R
Description: Binary data
___
R-SIG-Finance@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.

[R-SIG-Finance] calibration of GARCH models to futures data

2012-05-02 Thread Ivette
 I have done the usual estimation of GARCH models with R, applied to my
historical dataset (commodities futures) with a maximum likelihood function
and selected the best model on the basis of information criteria (AIC, BIC). 

 Can somebody explain me  the calibration scheme for a GARCH model with
futures data? 

 I was not able to find a paper, dealing with exactly this algorithm for my
case. I only understood from the unrelated calibration literature that in
general I have to compare the performance of the best model (from the
estimation step), fitted to my historical dataset and a  simulation (let's
abbreviate this Squared Error difference to E2). 

 However, it is not clear to me: 
 - with what parameters' values to start this simulation, 
 - how many times it is normal to perform it, 
 - what to compare via E2 (maximum likelihood values, or parameter values) 
 - how to construct  assess E2 for the GARCH case. 

 Thank you in advance for your suggestions. 
 
 Ivette


--
View this message in context: 
http://r.789695.n4.nabble.com/calibration-of-GARCH-models-to-futures-data-tp4603646.html
Sent from the Rmetrics mailing list archive at Nabble.com.

___
R-SIG-Finance@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.


[R-SIG-Finance] One week to R/Finance

2012-05-02 Thread Brian G. Peterson
We have a little over a week left till R/Finance Chicago, and it is
shaping up to be a full house as usual.  There is still a little room
left in all of the optional pre-conference seminars, so I expect those
to fill up soon.

Details and registration are in the links below.  
Looking forward to meeting you in Chicago,

 - Brian

 On 19 March 2012 at 21:03, Dirk Eddelbuettel wrote:
 | 
 | The registration for R/Finance 2012 -- which will take place May 11 and 12
 | in Chicago -- is NOW OPEN!
 |  
 | Building on the success of the three previous conferences in 2009, 2010,
 | and 2011, we expect more than 250 attendees from around the world.  R
 | users from industry, academia, and government will join 40+ presenters
 | covering all areas of finance with R.
 | 
 | This year's conference will start earlier in the day on Friday, to
 | accommodate the tremendous line up of speakers for 2012, as well as to
 | provide more time between talks for networking.
 | 
 | We are very excited about the four keynotes by Paul Gilbert, Blair
 | Hull, Rob McCulloch, and Simon Urbanek.  The main agenda includes
 | nineteen full presentations and eighteen shorter lightning talks.
 | We are also excited to offer six optional pre-conference seminars on
 | Friday morning.
 | 
 | Once again, we are hosting the R/Finance conference dinner on Friday
 | evening, where you can continue conversations while dining and
 | drinking atop a West Loop restaurant overlooking the Chicago skyline.
 | 
 | More details of the agenda are available at:
 | 
 |http://www.RinFinance.com/agenda/
 | 
 | Registration information is available at 
 | 
 |http://www.RinFinance.com/register/
 | 
 | and can also be directly accessed by going to
 | 
 |http://www.regonline.com/RFinance2012
 | 
 | 
 | On behalf of the committee and sponsors, we look forward to seeing you
 | in Chicago!
 | 
 |Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson,
 |Dale Rosenthal, Jeffrey Ryan, Joshua Ulrich
 | 
 | 
 | Our 2012 Sponsors:
 | 
 |International Center for Futures and Derivatives at UIC
 | 
 |Revolution Analytics
 |MS-Computational Finance at University of Washington
 | 
 |Google
 |lemnica
 |OpenGamma
 |OneTick
 |RStudio
 |Tick Data

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] One week to R/Finance

2012-05-02 Thread Marcus Felker
As I will be unable to attend in person is there an option to pay and
attend via a webcast ?

On Wed, May 2, 2012 at 12:05 PM, Brian G. Peterson br...@braverock.comwrote:

 We have a little over a week left till R/Finance Chicago, and it is
 shaping up to be a full house as usual.  There is still a little room
 left in all of the optional pre-conference seminars, so I expect those
 to fill up soon.

 Details and registration are in the links below.
 Looking forward to meeting you in Chicago,

  - Brian

  On 19 March 2012 at 21:03, Dirk Eddelbuettel wrote:
  |
  | The registration for R/Finance 2012 -- which will take place May 11
 and 12
  | in Chicago -- is NOW OPEN!
  |
  | Building on the success of the three previous conferences in 2009,
 2010,
  | and 2011, we expect more than 250 attendees from around the world.  R
  | users from industry, academia, and government will join 40+ presenters
  | covering all areas of finance with R.
  |
  | This year's conference will start earlier in the day on Friday, to
  | accommodate the tremendous line up of speakers for 2012, as well as to
  | provide more time between talks for networking.
  |
  | We are very excited about the four keynotes by Paul Gilbert, Blair
  | Hull, Rob McCulloch, and Simon Urbanek.  The main agenda includes
  | nineteen full presentations and eighteen shorter lightning talks.
  | We are also excited to offer six optional pre-conference seminars on
  | Friday morning.
  |
  | Once again, we are hosting the R/Finance conference dinner on Friday
  | evening, where you can continue conversations while dining and
  | drinking atop a West Loop restaurant overlooking the Chicago skyline.
  |
  | More details of the agenda are available at:
  |
  |http://www.RinFinance.com/agenda/
  |
  | Registration information is available at
  |
  |http://www.RinFinance.com/register/
  |
  | and can also be directly accessed by going to
  |
  |http://www.regonline.com/RFinance2012
  |
  |
  | On behalf of the committee and sponsors, we look forward to seeing you
  | in Chicago!
  |
  |Gib Bassett, Peter Carl, Dirk Eddelbuettel, Brian Peterson,
  |Dale Rosenthal, Jeffrey Ryan, Joshua Ulrich
  |
  |
  | Our 2012 Sponsors:
  |
  |International Center for Futures and Derivatives at UIC
  |
  |Revolution Analytics
  |MS-Computational Finance at University of Washington
  |
  |Google
  |lemnica
  |OpenGamma
  |OneTick
  |RStudio
  |Tick Data

 ___
 R-SIG-Finance@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.


[[alternative HTML version deleted]]

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] Efficiency of data.frame to xts conversion

2012-05-02 Thread Dirk Eddelbuettel

On 2 May 2012 at 17:18, Gordon Erlebacher wrote:
| Hi everybody, 
| 
| I have a MySQL database with stock information (using beancounter: thanks
| Kirk). 

Interesting off-by-one error...

| I return 30 stocks from the database (data.frame format by default)
| I am converting the data.frame to xts format. In the code below, 
| 
| 
| df   is the data.frame returned from the database. 
| data is what I get after conversion of df to an xts object. 
| 
| 
| Here is the problem: 
| 
| Getting 30 stocks from the data.base and return a data.frame takes 0.14 
seconds
| Including conversion to the more efficient xts structure, takes 2 seconds. 
| 
| If I had 3000 stocks, it is the difference between 14 sec and 3 min, which is
| quite large. 
| Is there a solution to this dilemma? Of course, I could recode the database
| access functions. 
| 
| One solution of course, is to convert to xts and save to a file, so that
| conversion is no longer necessary, and I might do that if nobody comes up with
| a more direct solution.

You are presumably getting killed by the as.Date which you don't need (I
think).  

With PostgreSQL, my preferred db backend, I know that the SQL date/datetime 
columns
come back as Date/Datetime in R.  Hence the timing increase it is not all
that big when I also convert to xts.

Twenty msec for the db access:

R system.time(SPY - dbGetQuery(con, select date, day_close as price from 
stockprices where symbol='SPY' order by date))
   user  system elapsed 
  0.020   0.000   0.039 
R head(SPY)
date   price
1 1993-01-29 37.8940
2 1993-02-01 38.1635
3 1993-02-02 38.2444
4 1993-02-03 38.6487
5 1993-02-04 38.8104
6 1993-02-05 38.7834

And around 100 msec for db access and xts conversion:

R system.time({ SPY - dbGetQuery(con, select date, day_close as price from 
stockprices where symbol='SPY' order by date); spy - xts(SPY[,-1], 
order.by=SPY[,1]) })
   user  system elapsed 
  0.104   0.000   0.121 
R head(spy)
  [,1]
1993-01-29 37.8940
1993-02-01 38.1635
1993-02-02 38.2444
1993-02-03 38.6487
1993-02-04 38.8104
1993-02-05 38.7834
R 


To really know you should profile.  And none of this really is a finance
question yet...

Dirk

-- 
R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] quantstrat with intraday data

2012-05-02 Thread G See
On Wed, May 2, 2012 at 10:57 PM, Jim Green
student.northwest...@gmail.com wrote:
 Thanks for the comment! personally I am hesitant to adjust intraday
 prices for splits or dividends, and I prefer adjust positions to
 account for the corp actions. Actually even for simplest technical
 analysis on daily data, I am still not sure if using dividend/split
 adjusted data is the right way to do.

 Jim.

If a stock splits in half, don't you think you should adjust for that
before performing technical analysis?  You'd treat that big jump in
price the same as a real price jump even though if you had a position
in the stock, your PnL would be unaffected by the split?

___
R-SIG-Finance@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.


Re: [R-SIG-Finance] quantstrat with intraday data

2012-05-02 Thread Jim Green
On 3 May 2012 00:07, G See gsee...@gmail.com wrote:
 If a stock splits in half, don't you think you should adjust for that
 before performing technical analysis?  You'd treat that big jump in
 price the same as a real price jump even though if you had a position
 in the stock, your PnL would be unaffected by the split?

sorry I was unclear... that would generate wrong signals..  I think
the correct way to use split/dividend adjusted daily data for
technical analysis is:
1, for each day, generate signals using adjusted data till before that
day, in a walking forward fashion.
2, for pnl logistics, use trade based adjustments or position adjustments.

the above are not currently supported by quantstrat and underlying
blotter but is really a nice to have. is qmao addressing the them in
some way?

Jim.

___
R-SIG-Finance@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.