Relative Content

Tag Archive for rtime-series

Delete a single value in dataframe based on particular date and time

I have a dataframe and I want to delete a single value based on the date and time, I want to delete the value for Variable 2 on the 2020-06-15 14:00:00 with an option to replace the value 780.45 with NA, or to leave it blank. I can find answers where the row is deleted based on the datetime but struggling to find where a single value is deleted.

Specifying an advanced GARCH model in R

I am writing my thesis and trying to use a specific kind of GARCH model. I am trying to implement it in R. I am pretty new to GARCH modeling in R so I am currently struggling to do anything out of the ordinary. I would like to build this kind of a model in R. I_t is a dummy variable indicating a day. S_t is a continous variable indicating a surprise. The idea is to allow the S_t to effect the conditional mean as well as the variance. s_t is defined as: 1+(sum from k-1 to 1)gamma(k)I(k)S_t(k). So eventually the idea is to capture the anticipation of the event, the contemperous effect of the event and persistance effect of the event on variance. The model is developed by Brenner, Pasquariello, and Subrahmanyam (2009).

How to automatically detect the sign of the slope in a time series with serrated shape in R?

I have a time series that looks like a jagged shape. I want to know the positive or negative slope of the jagged depression. Sometimes the noise in this time series can be heavy, so it is difficult to clearly see the positive or negative. I used a simple linear fitting to calculate the global slope and rregard it with the positive or negative slope. However, it is obvious that many times this did not work. Thank you. One example of the data in R is attached as follows, thank you.

Why do I get p value equal or very close to 1 with the dummy variable incorporated into the variance model using the rugarch package?

I have datasets for the daily change in stock price for 11 industries in U.S. I want to test whether the volatility is significantly different in the election period, so I also create a dummy variable that equal 1 during the election week. I incorporate the election dummy in the variance model in the tgarch model. However, I keep randomly get p value equals or very close to 1 for the election dummy, but for some industry the output is normal. I have tried both garch(1,1) and tgarch(1,1) for the year of 2004, 2008, 2012, and 2016. The industry that get p value of 1 is completely random and I don’t know what could go wrong with my code.

Identifying novel patterns in binary time series in R

I have a set of recorded observations about a binary animal behaviour (“open” or “closed”) taken from ~200 individuals before and after an intervention. The data are structured as the state of the animal at each second of the test, so essentially a string of:
|time|state|
|—-|—–|
|0 |closed|
|1|closed|
|2|open|
|3|open|
|4|closed|
|5|closed|