how to manually add data in a timeseries?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

how to manually add data in a timeseries?

patzoul
I have a timeseries and would like to add data for today. How can I do that?
Reply | Threaded
Open this post in threaded view
|

Re: how to manually add data in a timeseries?

braverock
On 04/07/2010 01:45 PM, patzoul wrote:
> I have a timeseries and would like to add data for today. How can I do that?
>    

try

?rbind

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: how to manually add data in a timeseries?

patzoul
My data is in variable x as shown below.

> x
           AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
2007-10-17    172.69    173.04   169.18     172.75    40271900        172.75

How can I add another line of data such as:
2010-04-07 250 250 250 250 0 250

Reply | Threaded
Open this post in threaded view
|

Re: how to manually add data in a timeseries?

braverock
On 04/07/2010 03:48 PM, patzoul wrote:

> My data is in variable x as shown below.
>
>    
>> x
>>      
>             AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
> 2007-10-17    172.69    173.04   169.18     172.75    40271900        172.75
>
> How can I add another line of data such as:
> 2010-04-07 250 250 250 250 0 250
>
>
>    
Thank you for taking the time to clarify your question.

However, the answer to your question will not change.

You will use rbind.

You may first need to use xts() to create your new row.

This is not really a finance question.

Please start with the xts documentation and vignettes.  If you are still
having trouble, try r-help.

   - Brian

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: how to manually add data in a timeseries?

patzoul
I did xts(t(c(250,0,250,0)), Sys.Date) to create the new line of data:
2010-04-08 250 0 250 0

and then use rbind to add it to the existing table.

thanks
Reply | Threaded
Open this post in threaded view
|

p-values of garch models

Konrad Hoppe
Hi list,

I'm actually trying to model some financial data with use of garch models
besides other stuff. But now I'm wondering how to extract the p-values from
the garch output. I'm just unable to get them. Do I have to calculate them
by my own or are there any other possibilities? Of course, I've already
checked the help function, but there aren't any advises.
Hope you can help me.

Thanks in advance,
Konrad Hoppe
http://www.konrad-hoppe.com/


        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: p-values of garch models

Sarbo
What about the Ljung-Box statistics from the GARCH estimation? Wouldn't
that provide the p-values you're looking for?

On Fri, 2010-04-09 at 23:37 +0200, Konrad Hoppe wrote:

> Hi list,
>
> I'm actually trying to model some financial data with use of garch models
> besides other stuff. But now I'm wondering how to extract the p-values from
> the garch output. I'm just unable to get them. Do I have to calculate them
> by my own or are there any other possibilities? Of course, I've already
> checked the help function, but there aren't any advises.
> Hope you can help me.
>
> Thanks in advance,
> Konrad Hoppe
> http://www.konrad-hoppe.com/
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] 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]]

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: p-values of garch models

Konrad Hoppe
Hi,

the Ljung Box statistic is valid for differrent models in my case and I want
to distinguish automatically between those different models. My problem is,
that it turns out, that there is more than one model with valid box
statistic, but only one has a residual series which looks like white noise,
and this model has only significant parameters, while the others have some
non-significant params. Hence I need to get these p-values from the model
and I think that there must be possibility since the p-values are
calculated, but I'm just unable to get them...
Any ideas to solve that problem?

Konrad Hoppe

-----Ursprüngliche Nachricht-----
Von: [hidden email]
[mailto:[hidden email]] Im Auftrag von Sarbo
Gesendet: Samstag, 10. April 2010 15:16
An: [hidden email]
Betreff: Re: [R-SIG-Finance] p-values of garch models

What about the Ljung-Box statistics from the GARCH estimation? Wouldn't
that provide the p-values you're looking for?

On Fri, 2010-04-09 at 23:37 +0200, Konrad Hoppe wrote:

> Hi list,
>
> I'm actually trying to model some financial data with use of garch models
> besides other stuff. But now I'm wondering how to extract the p-values
from

> the garch output. I'm just unable to get them. Do I have to calculate them
> by my own or are there any other possibilities? Of course, I've already
> checked the help function, but there aren't any advises.
> Hope you can help me.
>
> Thanks in advance,
> Konrad Hoppe
> http://www.konrad-hoppe.com/
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] 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]]

_______________________________________________
[hidden email] mailing list

-- 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]]


_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: p-values of garch models

braverock
On 04/12/2010 03:38 PM, Konrad Hoppe wrote:

> Hi,
>
> the Ljung Box statistic is valid for differrent models in my case and I want
> to distinguish automatically between those different models. My problem is,
> that it turns out, that there is more than one model with valid box
> statistic, but only one has a residual series which looks like white noise,
> and this model has only significant parameters, while the others have some
> non-significant params. Hence I need to get these p-values from the model
> and I think that there must be possibility since the p-values are
> calculated, but I'm just unable to get them...
> Any ideas to solve that problem?
>    

Konrad,

Please provide a reproducible code example.

Use one of the example data sets for whatever GARCH package you are
using, and tell us what package that is, and comment your example so we
can tell what you're doing.

You haven't given us enough information to say where you'll find the
p-values, since among other things you haven't even told us which of the
many GARCH functions within R you're using.

   - Brian

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

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: p-values of garch models

Konrad Hoppe

okay, I see the problem...I'm absolutely new to garch modelling and hence I didn't know that there are some many different functions. I've just thought that one of you already now my problem and there is a simple solution, anyway.
Now I've produced a code example:

#########################
install.packages("tseries")
library(tseries)

data <- vector(length=1000)
data[1] <- 0
set.seed(123)

for(i in 2:1000){
    data[i] <- 0.5*data[i-1] + rnorm(1)
}

garch.fit <- garch(data,order=c(1,1), trace=F)
summary(garch.fit)
########################

maybe you know another garch function where it's easier to get the p-values..
hope you can help me

all the best,
konrad


> Date: Mon, 12 Apr 2010 15:55:20 -0500
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]
> Subject: Re: [R-SIG-Finance] p-values of garch models
>
> On 04/12/2010 03:38 PM, Konrad Hoppe wrote:
> > Hi,
> >
> > the Ljung Box statistic is valid for differrent models in my case and I want
> > to distinguish automatically between those different models. My problem is,
> > that it turns out, that there is more than one model with valid box
> > statistic, but only one has a residual series which looks like white noise,
> > and this model has only significant parameters, while the others have some
> > non-significant params. Hence I need to get these p-values from the model
> > and I think that there must be possibility since the p-values are
> > calculated, but I'm just unable to get them...
> > Any ideas to solve that problem?
> >    
>
> Konrad,
>
> Please provide a reproducible code example.
>
> Use one of the example data sets for whatever GARCH package you are
> using, and tell us what package that is, and comment your example so we
> can tell what you're doing.
>
> You haven't given us enough information to say where you'll find the
> p-values, since among other things you haven't even told us which of the
> many GARCH functions within R you're using.
>
>    - Brian
>
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
>
>
     
_________________________________________________________________

[[elided Hotmail spam]]
        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: p-values of garch models

Matthieu Stigler


#see the structure:
str(summary(garch.fit))
#this is what you want, right?
summary(garch.fit)$coef[,4]

Konrad Hoppe a écrit :

> okay, I see the problem...I'm absolutely new to garch modelling and hence I didn't know that there are some many different functions. I've just thought that one of you already now my problem and there is a simple solution, anyway.
> Now I've produced a code example:
>
> #########################
> install.packages("tseries")
> library(tseries)
>
> data <- vector(length=1000)
> data[1] <- 0
> set.seed(123)
>
> for(i in 2:1000){
>     data[i] <- 0.5*data[i-1] + rnorm(1)
> }
>
> garch.fit <- garch(data,order=c(1,1), trace=F)
> summary(garch.fit)
> ########################
>
> maybe you know another garch function where it's easier to get the p-values..
> hope you can help me
>
> all the best,
> konrad
>
>
>  
>> Date: Mon, 12 Apr 2010 15:55:20 -0500
>> From: [hidden email]
>> To: [hidden email]
>> CC: [hidden email]
>> Subject: Re: [R-SIG-Finance] p-values of garch models
>>
>> On 04/12/2010 03:38 PM, Konrad Hoppe wrote:
>>    
>>> Hi,
>>>
>>> the Ljung Box statistic is valid for differrent models in my case and I want
>>> to distinguish automatically between those different models. My problem is,
>>> that it turns out, that there is more than one model with valid box
>>> statistic, but only one has a residual series which looks like white noise,
>>> and this model has only significant parameters, while the others have some
>>> non-significant params. Hence I need to get these p-values from the model
>>> and I think that there must be possibility since the p-values are
>>> calculated, but I'm just unable to get them...
>>> Any ideas to solve that problem?
>>>    
>>>      
>> Konrad,
>>
>> Please provide a reproducible code example.
>>
>> Use one of the example data sets for whatever GARCH package you are
>> using, and tell us what package that is, and comment your example so we
>> can tell what you're doing.
>>
>> You haven't given us enough information to say where you'll find the
>> p-values, since among other things you haven't even told us which of the
>> many GARCH functions within R you're using.
>>
>>    - Brian
>>
>> --
>> Brian G. Peterson
>> http://braverock.com/brian/
>> Ph: 773-459-4973
>> IM: bgpbraverock
>>
>>
>>    
>      
> _________________________________________________________________
>
> [[elided Hotmail spam]]
> [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] 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.
>

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: p-values of garch models

Patrick Burns-2
In reply to this post by Konrad Hoppe
George Box said:

All models are wrong,
some models are useful.

In particular all garch models are
wrong since markets change over time.
The best you can hope for is a model
that is adequate for your needs.

Looking at p-values won't necessarily
tell you the adequacy of the model for
your application.

Pat


On 12/04/2010 21:38, Konrad Hoppe wrote:

> Hi,
>
> the Ljung Box statistic is valid for differrent models in my case and I want
> to distinguish automatically between those different models. My problem is,
> that it turns out, that there is more than one model with valid box
> statistic, but only one has a residual series which looks like white noise,
> and this model has only significant parameters, while the others have some
> non-significant params. Hence I need to get these p-values from the model
> and I think that there must be possibility since the p-values are
> calculated, but I'm just unable to get them...
> Any ideas to solve that problem?
>
> Konrad Hoppe
>
> -----Ursprüngliche Nachricht-----
> Von: [hidden email]
> [mailto:[hidden email]] Im Auftrag von Sarbo
> Gesendet: Samstag, 10. April 2010 15:16
> An: [hidden email]
> Betreff: Re: [R-SIG-Finance] p-values of garch models
>
> What about the Ljung-Box statistics from the GARCH estimation? Wouldn't
> that provide the p-values you're looking for?
>
> On Fri, 2010-04-09 at 23:37 +0200, Konrad Hoppe wrote:
>
>> Hi list,
>>
>> I'm actually trying to model some financial data with use of garch models
>> besides other stuff. But now I'm wondering how to extract the p-values
> from
>> the garch output. I'm just unable to get them. Do I have to calculate them
>> by my own or are there any other possibilities? Of course, I've already
>> checked the help function, but there aren't any advises.
>> Hope you can help me.
>>
>> Thanks in advance,
>> Konrad Hoppe
>> http://www.konrad-hoppe.com/
>>
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> [hidden email] 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]]
>
> _______________________________________________
> [hidden email] mailing list
>
> -- 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]]
>
>
>
>
> _______________________________________________
> [hidden email] 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.

--
Patrick Burns
[hidden email]
http://www.burns-stat.com

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: p-values of garch models

Konrad Hoppe
In reply to this post by Matthieu Stigler

Thank you so much, I knew that there is a simple solution, but I've tried it the whole time with garch.fit$coef and there is nothing about p-values.


> Date: Tue, 13 Apr 2010 09:23:22 +0200
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]; [hidden email]
> Subject: Re: [R-SIG-Finance] p-values of garch models
>
>
>
> #see the structure:
> str(summary(garch.fit))
> #this is what you want, right?
> summary(garch.fit)$coef[,4]
>
> Konrad Hoppe a écrit :
> > okay, I see the problem...I'm absolutely new to garch modelling and hence I didn't know that there are some many different functions. I've just thought that one of you already now my problem and there is a simple solution, anyway.
> > Now I've produced a code example:
> >
> > #########################
> > install.packages("tseries")
> > library(tseries)
> >
> > data <- vector(length=1000)
> > data[1] <- 0
> > set.seed(123)
> >
> > for(i in 2:1000){
> >     data[i] <- 0.5*data[i-1] + rnorm(1)
> > }
> >
> > garch.fit <- garch(data,order=c(1,1), trace=F)
> > summary(garch.fit)
> > ########################
> >
> > maybe you know another garch function where it's easier to get the p-values..
> > hope you can help me
> >
> > all the best,
> > konrad
> >
> >
> >  
> >> Date: Mon, 12 Apr 2010 15:55:20 -0500
> >> From: [hidden email]
> >> To: [hidden email]
> >> CC: [hidden email]
> >> Subject: Re: [R-SIG-Finance] p-values of garch models
> >>
> >> On 04/12/2010 03:38 PM, Konrad Hoppe wrote:
> >>    
> >>> Hi,
> >>>
> >>> the Ljung Box statistic is valid for differrent models in my case and I want
> >>> to distinguish automatically between those different models. My problem is,
> >>> that it turns out, that there is more than one model with valid box
> >>> statistic, but only one has a residual series which looks like white noise,
> >>> and this model has only significant parameters, while the others have some
> >>> non-significant params. Hence I need to get these p-values from the model
> >>> and I think that there must be possibility since the p-values are
> >>> calculated, but I'm just unable to get them...
> >>> Any ideas to solve that problem?
> >>>    
> >>>      
> >> Konrad,
> >>
> >> Please provide a reproducible code example.
> >>
> >> Use one of the example data sets for whatever GARCH package you are
> >> using, and tell us what package that is, and comment your example so we
> >> can tell what you're doing.
> >>
> >> You haven't given us enough information to say where you'll find the
> >> p-values, since among other things you haven't even told us which of the
> >> many GARCH functions within R you're using.
> >>
> >>    - Brian
> >>
> >> --
> >> Brian G. Peterson
> >> http://braverock.com/brian/
> >> Ph: 773-459-4973
> >> IM: bgpbraverock
> >>
> >>
> >>    
> >      
> > _________________________________________________________________
> >
> > [[elided Hotmail spam]]
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > [hidden email] 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.
> >  
>
     
_________________________________________________________________

[[elided Hotmail spam]]
        [[alternative HTML version deleted]]


_______________________________________________
[hidden email] 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.