[R] autoregressive spectral density estimate by andrews' plug-in method?

2007-06-11 Thread Martin Ivanov
Hello!
I would like to ask if there is in R a function that estimates the spectral 
density function of a stochastic series at frequency zero by the plug-in 
method, advocated by Andrews in his paper Heteroscedasticity and 
Autocorrelation Consistent Covariance Matrix Estimation, Econometrica, 
59,817-858. I saw R has functions that employ Andrews' plug-in method using an 
AR(1) approximation for the estimation of the variance-covariance matrix in 
linear models. They come with the sandwich package. The so called meat is 
actually the estimate of the spectral density matrix of the model coefficients 
at frequency zero. However, I have a time series of length 160 and I need to 
estimate its spectral density via Andrews methodology. Any suggestions will be 
appreciated.
Excuse me if I am asking something obvious.

Regards,
Martin

-
Нека музиката бъде с теб! 
http://musicidol.btv.bg/

__
R-help@stat.math.ethz.ch 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] about the unscaled covariances from a summary.lm object

2007-05-29 Thread Martin Ivanov
Hello!
I want to clarify something about the unscaled covarinces component of a 
summary.lm object. So we have the regressor matrix X. If the fitted lm object 
is lmobj, the inverse of the matrix t(X)%*%X is xx, and the residual variance 
is sigma^2_e, the variance-covariance matrix of the OLS estimate of the 
coefficients is given by:
xx*sigma^2_e
I saw that what the function vcov actually does is simply:
vcov=summary(lmobj)$sigma^2 * summary(lmobj)$cov.unscaled
So the cov.unscaled component should give the matrix xx. I am right?
I tried inverting the matrix t(X)%*%X with solve by issuing:
solve(t(X)%*%X), but I get a matrix quite different from the matrix given by 
cov.unscaled. Is it just computational instability, or I am missing something 
important?

Regards,
Martin

__
R-help@stat.math.ethz.ch 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] modified test of phillips-perron

2007-04-20 Thread Martin Ivanov
Hello!
I would like to know whether the test of Phillips-Perron, modified for time 
series with large negative moving average terms implemented in R.
Besides I would also like to ask the same question about the Leybourne-McCabe 
test for stationarity.

Regards, Martin

__
R-help@stat.math.ethz.ch 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] about systemfit

2007-04-05 Thread Martin Ivanov
Hello. I am still a newbie in R. Excuse me if I am asking something obvious. My 
efforts to get an answer through browsing the mailing archives failed. I want 
to perform an augmented Dickey-Fuller test and to obtain AIC and BIC and to be 
able to impose some linear restrictions on the ADF regression so as to decide 
the correct order of autoregression. However I could find no obvious way to 
impose linear restrictions or to obtain AIC from the the result of ADF.test 
from uroot. That is why I turned to systemfit. I ran the ADF regression with 
systemfit and obtained the same coefficient estimates as through ADF.test (as 
it had to be). Unfortunately I could not find how to extract AIC from the 
result of systemfit, so I evaluated the ADF regression by lm. So far so good. 
However the results of ftest.systemfit and linear.hypothesis from the car 
package are very different, while the results from waldtest.systemfit and 
linear.hypothesis coincide. I have no explanation for this issue a
 nd I could not see the code of linear.hypothesis. When I type 
linear.hypothesis I get:
function (model, ...) 
UseMethod(linear.hypothesis)
environment: namespace:car

but when I type ftest.systemfit, I do see the actual code. Why? 
Anyway, here are the results in more detail:

eqns-list(eq = y ~ trend+ x1 + x[,1] + x[,2] + x[,3] + x[,4] + x[,5] + x[,6] + 
x[,7] + x[,8] + x[,9] + x[,10] + x[,11] + x[,12] + x[,13]

Rrestr10-matrix(0,10,16);Rrestr10[1,16]=Rrestr10[2,15]=Rrestr10[3,14]=Rrestr10[4,13]=Rrestr10[5,12]=Rrestr10[6,11]=Rrestr10[7,10]=Rrestr10[8,9]=Rrestr10[9,8]=Rrestr10[10,7]=1

adfResc-systemfit(method=OLS,eqns=eqns,R.restr=Rrestr10)

adfResu-systemfit(method=OLS,eqns=eqns)

adfResulm-lm(formula=eqns$eq)

ftest.systemfit( object=adfResu, R.restr=Rrestr10) :

F-test for linear parameter restrictions in equation systems
F-statistic: 9.083 
degrees of freedom of the numerator: 10 
degrees of freedom of the denominator: 127 
p-value: 3.449e-11 

linear.hypothesis(model=adfResulm,hypothesis.matrix=Rrestr10,test=F):

 Res.Df RSS  Df Sum of Sq  F Pr(F)
1127  7.3782
2137  7.6848 -10   -0.3066 0.5277  0.868

As I said, the results of 
the chisquare test with linear.hypothesis and the waldtest.systemfit coincide.
I have one more problem. This is the output of lrtest.systemfit:
lrtest.systemfit(resultc=adfResc,resultu=adfResu)

Likelihood-Ratio-test for parameter restrictions in equation systems
LR-statistic:  
degrees of freedom: 
p-value:  

Why do I get empty values?
In summary, I need to understand why the two ftests give different results; why 
lrtest.systemfit gives empty output; is there some way to extract AIC and BIC 
from object of class systemfit or from the result of ADF.test.

Excuse me if I am asking something too obvious, but I am really at a loss.

Any suggestions on any of the above questions will be welcomed.

Regards,
Martin

__
R-help@stat.math.ethz.ch 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] about systemfit

2007-04-05 Thread Martin Ivanov
Thank you very much for your responsiveness. Here are the tests that show the 
same results, as they must:

linear.hypothesis(model=adfResulm,hypothesis.matrix=Rrestr10,test=Chisq):
 Res.Df RSS  Df Sum of Sq  Chisq Pr(Chisq)
1127  7.3782
2137  7.6848 -10   -0.3066 5.2769  0.872

waldtest.systemfit(object=adfResu,R.restr=Rrestr10):

Wald-test for linear parameter restrictions in equation systems
Wald-statistic: 5.277 
degrees of freedom: 10 
p-value: 0.8719 

So the Chisq test with linear.hypothesis from car and the waldtest.systemfit 
give the same output. But the  F test with linear.hypothesis from car and 
ftest.systemfit give absolutely different results, as I demonstrated in my 
first post. I have no idea why.

Regards,
Martin

__
R-help@stat.math.ethz.ch 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] lag orders with ADF.test

2007-02-13 Thread Martin Ivanov
Hello! 
 I do not understand what is meant by: 
 
 aic and bic follow a top-down strategy based on the Akaike's and Schwarz's 
information criteria 
 
in the datails to the ADF.test function. What does a top-down strategy mean? 
Probably the respective criterion is minimized and the mode vector contains the 
lag orders at which the criterion attains it local minima? When the calculation 
is over, the ADF.test function gives info about Lag orders. What are these 
lag orders? Are they the local minima of the criterion? 
 
 I will be very thankful if you clarify this to me. I browsed a lot, but I 
could not find a clear answer. 
 
 Thank you for your attention. 
 Regards, 
 Martin

-
http://auto-motor-und-sport.bg/ 
С бензин в кръвта!

__
R-help@stat.math.ethz.ch 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] adf test: trend, no drift - rep: invalid 'times' argument

2007-02-13 Thread Martin Ivanov
Hello!

I am applying the ADF.test function from package uroot to a time series of 
data. When I apply the full test, incorporating drift and trend terms, the 
regressor estimate of the drift term is not significantly different from zero. 
So I  apply the test to a model without drift term, with deterministic trend 
only. But then I always get the following error:

summary(ADF.test(wts=ts(seasons$summer, start=1850, frequency=1), 
itsd=c(0,1,c(0)), regvar=0, selectlags=list(mode=c(1,2,3
Error in rep(NA, ncol(table)) : invalid 'times' argument
Error in summary(ADF.test(wts = ts(seasons$summer, start = 1850, frequency = 
1),  : 
error in evaluating the argument 'object' in selecting a method for 
function 'summary'

I have no idea why this error occurs. Any suggestions will be appreciated.

Regards,
Martin

-
http://auto-motor-und-sport.bg/ 
С бензин в кръвта!

__
R-help@stat.math.ethz.ch 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] weighted MDS, alscal

2007-01-18 Thread Martin Ivanov
Hello!
I need to perform weighted multidimensional scaling analysis(WMDS). I did 
rsitesearch, googled, but I could find no info on how to perform WMDS using R. 
In several places they say it is possible with the ALSCAL algorithm, but I 
could not find the relevant function to carry it out.


-
Заложете на късмета си със Спортингбет!

__
R-help@stat.math.ethz.ch 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] analog to the matlab buffer function?

2006-11-30 Thread Martin Ivanov
Hello!
I am new to R. I could not find a function analogous to matlab's function 
buffer, which is used in signal processing. Is there such a function in R?
What I need to do is as follows. If I apply the function to the vector c(1:5) 
for example with a window length 3 and overlapping 2, I need to get a matrix 
like this:
1 2 3
2 3 4
3 4 5
In matlab this is achieved with the function buffer. Is there ananalogous R 
function?

Thank you very much in advance.
Regards,
Martin

__
R-help@stat.math.ethz.ch 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] nonlinear least squares fitting Trust-Region

2006-09-02 Thread Martin Ivanov
Dear Mr Graves,
Thank you very much for your response. Nobody else from this mailing list 
ventured to reply to me for the two weeks since I posted my question.
nlminb and optim are just optimization procedures. What I need is not just 
optimization, but a nonlinear CURVE FITTING procedure. If there is some way to 
perform nonlinear curve fitting with the Trust-Region algorithm using any of 
these functions, I would me much obliged to you if you suggest to me how to 
achieve that. You asked me why I do not want Gauss-Newton. Since I am not an 
expert in the field of optimization, I am just conforming to what matlab 
documentation suggests, namely:
Algorithm used for the fitting procedure: Trust-Region -- This is the default 
algorithm and must be used if you specify coefficient constraints. 
Levenberg-Marquardt -- If the trust-region algorithm does not produce a 
reasonable fit, and you do not have coefficient constraints, you should try the 
Levenberg-Marquardt algorithm. Gauss-Newton --THIS ALGORITHM IS POTENTIALLY 
FASTER THAN THE OTHER ALGORITHMS, BUT IT ASSUMES THAT THE RESIDUALS ARE CLOSE 
TO ZERO. IT IS INCLUDED FOR PEDAGOGICAL REASONS AND SHOULD BE THE LAST CHOICE 
FOR MOST MODELS AND DATA SETS. 
I browsed some literature about the garchfit function, but I did not see the 
Trust-Region algorithm there either: algorithm = c(sqp, nlminb, lbfgsb, 
nlminb+nm, lbfgsb+nm), control = list(), title = NULL, description = NULL, 
...)

Thank you for your attention. I am looking forward to your reply.
Regards,
Martin

-
vbox7.com - Забавни видео клипове!

__
R-help@stat.math.ethz.ch 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] nonlinear least squares trust region fitting ?

2006-08-28 Thread Martin Ivanov
Hello!

I am running R-2.3.1-i386-1 on Slackware Linux 10.2. I am a former matlab user, 
moving to R. In matlab, via the cftool, I performed nonlinear curve fitting 
using the method nonlinear least squares with the Trust-Region algorithm 
and not using robust fitting. Is it possible to perform the same analysis in R? 
I read quite a lot of R documentation, but I could not find an alternative 
solution. If there is such, please forgive my ignorance (I am a newbie in R) 
and tell me which function from which package is capable of performing the same 
analysis. If the same analysis is not possible to carry out in R, I would be 
grateful if you suggest to me some alternative procedure. I found that the 
nls function performs nonlinear least squares. The problem is that I do not 
want to implement the Gauss-Newton algorithm. In the worst case I would be 
contented with the Levenberg-Marquardt algorithm, if it is implemented in R. 
R nls's documentation mentions the port package and the ‘nl
 2sol’ algorithm, but I could not find that package in the CRAN repository, so 
that I could read and judge whether that algorithm would be appropriate.

Thank you very much in advance. I am looking forward to your answer.
Regards,
Martin

-
http://ide.li/ - портал за българите по света. Статии, новини, форуми, снимки, 
информация.

__
R-help@stat.math.ethz.ch 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] nonlinear least squares trust region fitting ?

2006-08-23 Thread Martin Ivanov
Hello!

I am running R-2.3.1-i386-1 on Slackware Linux 10.2. I am a former matlab user, 
moving to R. In matlab, via the cftool, I performed nonlinear curve fitting 
using the method nonlinear least squares with the Trust-Region algorithm 
and not using robust fitting. Is it possible to perform the same analysis in R? 
I read quite a lot of R documentation, but I could not find an alternative 
solution. If there is such, please forgive my ignorance (I am a newbie in R) 
and tell me which function from which package is capable of performing the same 
analysis. If the same analysis is not possible to carry out in R, I would be 
grateful if you suggest to me some alternative procedure. I found that the 
nls function performs nonlinear least squares. The problem is that I do not 
want to implement the Gauss-Newton algorithm. In the worst case I would be 
contented with the Levenberg-Marquardt algorithm, if it is implemented in R. 
R nls's documentation mentions the port package and the ‘nl
 2sol’ algorithm, but I could not find that package in the CRAN repository, so 
that I could read and judge whether that algorithm would be appropriate.

Thank you very much in advance. I am looking forward to your answer.
Regards,
Martin

-
http://ide.li/ - портал за българите по света. Статии, новини, форуми, снимки, 
информация.

__
R-help@stat.math.ethz.ch 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] NonLinearLeastSquares Trust-Region

2006-08-22 Thread Martin Ivanov
Hello!

I am running R-2.3.1-i386-1 on Slackware Linux 10.2. I am a former matlab user, 
moving to R. In matlab, via the cftool, I performed nonlinear curve fitting 
using the method nonlinear least squares with the Trust-Region algorithm 
and not using robust fitting. Is it possible to perform the same  analysis in 
R? I read quite a lot of R documentation, but I could not find an alternative 
solution. If there is such, please forgive my ignorance (I am a newbie in R) 
and tell me which function from which package is capable of performing the same 
analysis. If the same analysis is not possible to carry out in R, I would be 
grateful if you suggest to me some alternative procedure. I found that the 
nls function performs nonlinear least squares. The problem is that I do not 
want to implement the Gauss-Newton algorithm. In the worst case I would be 
contented with the Levenberg-Marquardt algorithm, if it is implemented in R. 
R nls's documentation mentions the  port  package and the 
  ‘nl2sol’ algorithm, but I could not find that package in the CRAN repository, 
so that I could read and judge whether that algorithm would be appropriate.

Thank you very much in advance. I am looking forward to your answer.
Regards,
Martin

-
http://ide.li/ - портал за българите по света. Статии, новини, форуми, снимки, 
информация.

__
R-help@stat.math.ethz.ch 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.