[R] ARCH modelling/MA process

2012-06-06 Thread and_mue
Hi all

ARCH modelling


I have a problem now on how to proceed with further steps in my analysis. I
did a linear OLS regression with my daily data of stock and index returns.
There is now the problem of arch in my error terms. Thus I used the
following r command:

garch(resid_desn, order=c(0,2)) ## This ARCH(2) process seems to fit the
best after trial and error. Consequently,  I get there three a's.
(resid_desn are the residuals of the ols regression of the company desn)

The problem is now that I want to analyse the excess return for a given
period. I don't know how I should include these a's in my linear regression
to address this problem and get new alphas and betas... 
/(FOR INFORMATION: excess return without ammendements for ARCH effects is
given as: êt=Ri,t-alpha(from regression)-beta(from regression)*Rm,t)/

There is a paper which does this in a simple manner (see page 12 and 13 of 
http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1100573
http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1100573 ). It is
described as follows:

Ri=alpha(arch)+beta(arch)*Rm,i+et
et=thetat*sqrt(h)
h=lamda(0)+lamda(1)*e(t-1)^2  ##e are the residuals of the ols regression

Thus my question is now: How can I regress this?

Ri=alpha(arch)+beta(arch)*Rm,i+thetat*sqrt(h) ## This seems not to work as
it calculates an additional errorterm. Also the parameter theta changes over
time. Thus the problem is on how I should estimate this one I hope there
is a solution for this problem or some hints on how I can use the output of
the garch model for my linear regression and the estimation of new alphas
and beta (with consideration of ARCH effects).

MA Process:

I have for example an MA(1) process. This mean that ut=et+theta*et-1
Thus the linear regression gets (also excess return on the left hand side):
et=Ri,t-alpha-beta*Rm,i-theta*et-1
The problem is now that et depends on et-1. I want to start with et-1=0,
thus I cant do this with one formula. And typing this in for 180 days is
simply to time consuming. 

Any suggestions on that Problem? One solution would be to do this with
excel.

Thanks and kind regards
Andi


Kind regards
Andi



--
View this message in context: 
http://r.789695.n4.nabble.com/ARCH-modelling-MA-process-tp4632535.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with ARCH

2012-06-08 Thread and_mue
Hi

I have a problem on how to proceed with further steps in my analysis. I did
a linear OLS regression (ri,t=alpha*beta*rm,t+et) with my daily data of
stock and index returns. There is now the problem of arch in my error terms.
Thus I used the following r command: 

/garch(resid_desn, order=c(0,2)) ## This ARCH(2) process seems to fit the
best after trial and error. Consequently,  I get there three a's.
(resid_desn are the residuals of the ols regression of the company desn) /

And now I am stuck. For further analysis I want to estimate new alphas and
betas which do incorporate this ARCH effect (thus including all the a's in
some way). There is a paper which does this in a simple manner (see page 12
and 13 of http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1100573). It is
described as follows: 

/Ri=alpha(arch)+beta(arch)*Rm,i+et  ## equation one
et=ut*sqrt(h) 
h=lamda(0)+lamda(1)*e(t-1)^2+lamda(2)*e(t-2)^2  ##e are the residuals of the
ols regression /

I don't know how I should include these a's in my linear regression to
address this problem and get new alphas and betas. I tried to substitute and
rearrange (h can be calculated from the ols and garch output, then I
substitute et in equation one with ut*sqrt(h) and divide the whole equation
by sqrt(h)). After the regression procedure there is still significant ARCH
effect in my model. I don't know if dividing is the right step but without
this, r would incorporate another error term. My assumption is that ut is an
error term.

The purpose of this is to estimate excess returns after the estimation
period.
(FOR INFORMATION: excess return without ammendements for ARCH effects is
given as: êt=Ri,t-alpha-beta*Rm,t)

Thus my question is now: How can I regress this to get results without ARCH
effect? 

I hope there is a solution for this problem or some hints on how I can use
the output of the garch model for my linear regression and the estimation of
new alphas and beta (with consideration of ARCH effects).  *Help is really
appreciated!!!*

Kind regards
Andi

--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-ARCH-tp4632778.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] looking for an add-in for daily data analysis

2012-04-26 Thread and_mue
Hi all

I am looking for an add-in. I am currently working on something and I use
daily data of closing stock prices. As not all companies are traded daily
(e.g. on monday, then on thursday etc) at the stock exchange, there is
satistically a problem. There are some papers which explain the approach to
handle infrequent trading of a stock or non synchronous data and beta
estimation (Dimson, 1979; Scholes & Williams, 1977). I looked for add-ins
which do address this topic, but i couldn't find any.

I have to calculated daily returns from the daily colsing stock prices.
Afterwards I want to estimate the alphas and betas of the market model for a
given timeperiod. Then I calculate abnormal returns and CAR's and assess
their significance (event study methodology with the market model). 

Does someone have any idea on how I should handle these problems or a link
for an appropriate package? For implementing these statistics on my own, I
knowledge in R is not sufficient.

Kind Regards
AM

--
View this message in context: 
http://r.789695.n4.nabble.com/looking-for-an-add-in-for-daily-data-analysis-tp4589711p4589711.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with Autocorrelation and GLS Regression

2012-05-25 Thread and_mue
Hi,

I have a problem with a regression I try to run. I did an estimation of the
market model with daily data. You can see to output below:

/> summary(regression_resn)
Time series regression with "ts" data:
Start = -150, End = -26
Call:
dynlm(formula = ror_resn ~ ror_spi_resn)

Residuals:
   Min 1Q Median 3QMax 
-0.0255690 -0.0030378  0.0002787  0.0039887  0.0257857 

Coefficients:
   Estimate Std. Error t value Pr(>|t|)
(Intercept)  -0.0003084  0.0007220  -0.4270.670
ror_spi_resn  0.0363940  0.0706150   0.5150.607

Residual standard error: 0.008016 on 123 degrees of freedom
Multiple R-squared: 0.002155,   Adjusted R-squared: -0.005958 
F-statistic: 0.2656 on 1 and 123 DF,  p-value: 0.6072 /

I did several tests for assessing the quality of the estimation (like
breusch-pagan, breusch-godfrey, chow-breakpoint, arch lm tests).  The model
has now clearly a problem with autocorrelation as you can see in de images
below:
http://r.789695.n4.nabble.com/file/n4631336/resid_resn.png 
http://r.789695.n4.nabble.com/file/n4631336/pacf_resid_resn.png 
To take into account the problem of autocorrelation, I did a gls estimation
with an AR(1) process and get the following output: 

/> summary(gls(ror_resn~ror_spi_resn, correlation=corARMA(p=1),
method="ML"))
Generalized least squares fit by maximum likelihood
  Model: ror_resn ~ ror_spi_resn 
  Data: NULL 
AIC   BIC   logLik
  -859.0308 -847.7176 433.5154

Correlation Structure: AR(1)
 Formula: ~1 
 Parameter estimate(s):
   Phi 
-0.3182399 

Coefficients:
   Value  Std.Errort-value p-value
(Intercept)  -0.00034277 0.00052344 -0.6548430  0.5138
ror_spi_resn  0.04337265 0.06741179  0.6433986  0.5212

 Correlation: 
 (Intr)
ror_spi_resn -0.159

Standardized residuals:
Min  Q1 Med  Q3 Max 
-3.21202187 -0.38283220  0.03863226  0.50313857  3.24224614 

Residual standard error: 0.007953852 
Degrees of freedom: 125 total; 123 residual/

I plot acf and pacf again to assess the changes in autocorrelation. But
interestingly, there is no change in the plots, they are equal to the images
above...

Can anyone give advice on how to handle this problem?  There is the
possibility that I am clearly on the wrong path. I am still a beginner in
using R. Furthermore, I did the same procedure with EVIEWS (also
implementing AR(1) process) and the model gives different results for the
coefficients and error terms. 

Regards
Andi

/Output EVIEWS:

Dependent Variable: ROR_RESN
Method: Least Squares   
Date: 05/25/12   Time: 17:17
Sample (adjusted): 2 125
Included observations: 124 after adjustments
Convergence achieved after 7 iterations 

VariableCoefficient Std. Error  t-Statistic Prob.  

C   -0.000409   0.000525-0.779074   0.4375
ROR_SPI_RESN0.0529960.0677940.7817160.4359
AR(1)   -0.314260   0.085592-3.671586   0.0004

R-squared   0.104144Mean dependent var  -0.000365
Adjusted R-squared  0.089337S.D. dependent var  0.007945
S.E. of regression  0.007581Akaike info criterion   
-6.902354
Sum squared resid   0.006955Schwarz criterion   
-6.834122
Log likelihood  430.9460Hannan-Quinn criter.
-6.874637
F-statistic 7.033211Durbin-Watson stat  2.070520
Prob(F-statistic)   0.001289

Inverted AR Roots-.31   
/

--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-Autocorrelation-and-GLS-Regression-tp4631336.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with Autocorrelation and GLS Regression

2012-05-25 Thread and_mue
For the analysis I follow the approach of Keown & Pinkerton (
http://e-m-h.org/KePi81.pdf http://e-m-h.org/KePi81.pdf ). They do also use
daily data to compute alphas and betas of the market model. These estimated
coefficients are then used to estimate abnormal returns for a given period. 

market model would be: 
Rjt=ajt+bjt*Rmt+ejt

Rjt is the return of company j on day t
Rmt is the return of the market on day t (Index)
ejt is the unsystematic component of firm j's return

after estimation I want to estimate abnormal returns:
êjt=Rjt-(âj+bj*Rmt)
aj and bj are the estimatet coefficients from the equation above.

--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-Autocorrelation-and-GLS-Regression-tp4631336p4631355.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Arima model, breusch godfrey/breusch pagan test

2012-05-28 Thread and_mue
Hi all

I did an estimation of a simple regression model (ror_xxx~ror_spi_xxx) and
assessed the quality of this estimation. After having detected that there
are indications of autocorrelatio and an AR(1) process, I used an arima
model:

absi.arima=arima(ror_absi, order=c(1,0,0), xreg=ror_spi_absi)
Output: 
> absi.arima

Call:
arima(x = ror_absi, order = c(1, 0, 0), xreg = ror_spi_absi)

Coefficients:
  ar1  intercept  ror_spi_absi
  -0.5377 -1e-04   -0.0060
s.e.   0.0752  3e-040.0215

sigma^2 estimated as 1.579e-05:  log likelihood = 513.49,  aic = -1018.97

This eliminated the arch effect in my model, but I  want to check weather
there is still any autocorrelation in my model (with breusch godfrey test,
bgtest). My question is now on how to implement this in the bgtest function.
As there has to be typed in the exact equation of the model or a fitted lm
model, I do not have any idea on what to do now Is there a simple
solution for my problem? Same question would be when using the breusch pagan
test.

Any suggestions are higly appreciated!

Kind regards,
Andi



--
View this message in context: 
http://r.789695.n4.nabble.com/Arima-model-breusch-godfrey-breusch-pagan-test-tp4631617.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.