[R] Time series temporal disaggregation
Hi, This is a newbie question. I would to be able to convert annual time series of flow data into quarterly data. I wonder if there is any existing R-function which permits to do it? In what package ? I the archive, i found that some poeple speak about tempDis package for performing time series temporal disaggregation, but when I try to download it I can not found it in the list of proposed packages. Tank you in advance for your help. [[alternative HTML version deleted]] __ 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] Systemfit package
Dear Arne Henningsen, I send you this message because I have question with regard to systemfit package. I hope you answer to my request. I estimated a system of equation bu using SUR method. The function summary(xx) gives me summary of estimated equation system. However, this function does not give my the value of the durbin watson statistic for each one of my equations (to chek for serial correlation). Thus, my question is is there any function in the systemfit package which permit to return the value of durbin watson statistic or should I write my own program ? Thank you in advance [[alternative HTML version deleted]] __ 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] Cointegration/urca package
Hello! I estimate vector error correction model (vecm) model. I have only one cointegratio relationship. I write : joh.vecm.rls - cajorls(joh.vecm, r=1) The output estimation is : Call: lm(formula = substitute(form1), data = data.mat) Coefficients: up.d expl.dupd.d r.d ect1 -1.34e-01 4.55e+02 6.91e+00 2.43e+03 constant -4.90e+01 1.82e+05 2.46e+03 9.54e+05 up.dl1 6.68e-01 2.07e+03 3.49e+01 2.51e+03 expl.dl1 1.72e-04 -1.87e-01 9.22e-03 1.34e-01 upd.dl1 -2.48e-03 8.15e+00 4.36e-01 2.29e+01 r.dl1 2.70e-05 -6.75e-02 -1.95e-03 -7.64e-01 up.dl2 -4.32e-01 1.10e+03 5.14e+00 -2.45e+03 expl.dl2 6.01e-05 -1.24e-01 -9.52e-03 -6.65e-01 upd.dl2 -2.88e-03 9.40e+00 2.31e-01 1.74e+01 r.dl2 5.56e-05 -1.46e-01 -1.03e-03 -5.47e-01 $beta ect1 up.l3 1.000 expl.l3 -0.0002939 upd.l3 -0.0004689 r.l3 -0.0002649 trend.l3 8.5983895 I have two questions : Can I say that my cointegration relationship is not valide because the ect1 term is not of negative sign for expl.d, upd.d and r.d ? How can I exract the t-sudent of all the coefficients ? any help will be appreciated. Thank you in advance. [[alternative HTML version deleted]] __ 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] Error message when performing cointegration and causality tests
Hello, I write this message because I have a problem with cointegration and causality tests on R. I'm working with time series data. I use ucra and vars packages.To perform cointegration and Granger causality tests, I respectively write : sjv - vardata[, c(upd, nc, r, up, op, ur, expl)] sjv.vecm - ca.jo(sjv, type=eigen, K=2, spec = longrun, season =4) summary(sjv.vecm) reg1.caus - VAR(vardata[, c(upd, nc, r, up, op, ur, expl)], p = 2, type = const) causality(reg1.caus, cause = up) In both cases, I respectively obtain the following error messages: Error is solve.default(M11) : the system is numerically singular : conditionnement de la réciproque = 9.47575e-17 and Error is solve.default(crossprod(as.matrix(Z))) : the system is numerically singular : conditionnement de la réciproque = 7.87318e-22 What do these messages mean ? And how can I resolve this problem? I precise that I use quarterly data and that when I try to directly estimate VAR model using the command below I encounter no problem: reg1 - VAR(vardata[, c(upd, nc, r, up, op, ur, expl)], p = 1, type =const) reg1 Thank you in advance for answer. Axel [[alternative HTML version deleted]] __ 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] Linear model with coefficient restriction
Hi every one I perform a simple linear regression lm(a b + c + d , data = data1) How to say to R to perform and print the regression with restricting the coefficient of the variable c to be equal to 0.1. In the model print, I want to show the p-values of all my coefficients. Thank you in advance. Axel [[alternative HTML version deleted]] __ 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] Error messages/systemfit package
Hello !  Iâm trying to estimate a system of equation (demand and supply) using the systemfit package. My program is:  library(systemfit) demand - tsyud ~ tsyud1 + tsucp + tspo + tssn supply - tscn ~ tsyn + tsqn + tsksn + tsucp system - list(demand=eqdemand, learning = eqsupply) labels - list(demand=eqdemand, learning=eqsupply) inst - ~ tsupp1 + tsupp2 + tsupp3 + tsyus1 + tsupf + tsd1 + tsyud1 + tspo + tssn + tsupp + tsus + tsus1 + tsyn + tsqn + tsksn result2sls -systemfit(method=2SLS, system, labels, inst=inst)   This does not work and I have the following error message that I do not understand its meaning:  Error in solve(crossprod(zMatEq[[i]]), crossprod(zMatEq[[i]], xMatAllThisEq), :  the leading minor of order 3 is not positive definite  Can you help me please to understand the problem?   Remark1: Please note that in my estimation, the variables tsyud1, tsupp1, tsupp2, tsupp3, and tsyus1 are lagged variables.  Remark2: When I try to estimate each one of my two equations separately using the sem package, I also have an error message:  supplyreg - tsls(tscn ~ tsyn + tsqn + tsksn + tsucp, ~ tsupp1 + tsupp2 + tsupp3 + tsyus1 + tsupf + tsd1 + tsyud1 + tspo + tssn + tsupp + tsus + tsus1 + tsyn + tsqn + tsksn) summary(supplyreg)  Error in solve.default(crossprod(Z))Lapack routine dgesv: system is exactly singular  Do the two error messages mean the same think?  Thank you in advance for your help. [[alternative HTML version deleted]] __ 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] Chow test(1960)/Structural change test
  Thank your for your answer. I try to perform the Chow test with the formula as you suggest and it works. Nevertheless, I would like to ask additional questions please :   The first one is related to the early one that I have asked to my first message:  When I try to perform another structural change tests, in particular those ones which are based on the Fstats , I write the following code:  fsaveF - Fstats(reg1, from = 7, to = 22, data = data1) sctest(fsaveF, type = aveF)  which give me the following results :         aveF test  data: fsaveF ave.F = 55.15, p-value = 4.329e-15  But when I try the same test with sctest(reg1 , type = aveF, data = data), this does not work although reg1 is already known. When I replace reg1 by a ~ b + c + d the test works. When should I use the fitted model rather than the formula in a structural change test and vis versa ?  I precise that in my case reg1 correspond to a ~ b + c + d.  Second question:  The structural change tests based on the generalized fluctuation test framework that I have performed (Rec-CUSUM and Rec-MOSUM) give me an opposite results (No structural change) with regard to F test framework (there is a structural change). How to deal with this contradiction?  Third question:  Since I have autocorrelation in my regression, should I perform structural change test before or after correcting for autocorrelation?  Many thanks --- En date de : Dim 17.5.09, Achim Zeileis achim.zeil...@wu-wien.ac.at a écrit : De: Achim Zeileis achim.zeil...@wu-wien.ac.at Objet: Re: [R] Chow test(1960)/Structural change test Ã: Axel Leroix axel.ler...@yahoo.fr Cc: r-help@r-project.org Date: Dimanche 17 Mai 2009, 23h22 On Sun, 17 May 2009, Axel Leroix wrote: Hi,  A question on something which normally should be easy !  I perform a linear regression using lm function:  reg1 - lm (a b+c+d, data = database1)  Then I try to perform the Chow (1960) test (structural change test) on my regression. I know the breakpoint date. I try the following code like it is described in the âExamplesâ section of the âstrucchangeâ package :  sctest(reg1, data = database1, type = Chow,  point = 20, asymptotic = FALSE) You just need the formula, not the fitted model: sctest(a ~ b + c + d, data = database1, type = Chow, point = 20) If you want to perform it by hand, then the following should work: fit the nested model and then perform the model comparison calling anova() (or lrtest() from lmtest for the asymptotic version). reg2 - lm(a ~ factor(1:nrow(database1) = 20) / (b + c + d),    data = database1) anova(reg1, reg2) hth, Z  Unfortunately, this does not work and I have the following error message:  Error in UseMethod(sctest) : No applied method for sctest.  I guess that I should compute fs statistics first (Fisher statistics) but Iâm not sure about my guess. Moreover, in case my guess is true I do know how to do it although I have read the package documentation! On the basis of this documentation Iâm able to perform other structural change test (CUSUM, MOSUMâ¦) but Iâm particularly interested in the Chow (1960) test. So please is there someone who can help me in implementing it.  Many thanks in advance.      [[alternative HTML version deleted]] [[alternative HTML version deleted]] __ 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] Chow test(1960)/Structural change test
Hi,  A question on something which normally should be easy !  I perform a linear regression using lm function:  reg1 - lm (a b+c+d, data = database1)  Then I try to perform the Chow (1960) test (structural change test) on my regression. I know the breakpoint date. I try the following code like it is described in the âExamplesâ section of the âstrucchangeâ package :  sctest(reg1, data = database1, type = Chow,  point = 20, asymptotic = FALSE)  Unfortunately, this does not work and I have the following error message:  Error in UseMethod(sctest) : No applied method for sctest.  I guess that I should compute fs statistics first (Fisher statistics) but Iâm not sure about my guess. Moreover, in case my guess is true I do know how to do it although I have read the package documentation! On the basis of this documentation Iâm able to perform other structural change test (CUSUM, MOSUMâ¦) but Iâm particularly interested in the Chow (1960) test. So please is there someone who can help me in implementing it.  Many thanks in advance.   [[alternative HTML version deleted]] __ 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] Data extraction problem after importation using RODBC
Dear all, I write this message because I have a problem in data importation. I hope that you help me. My data base is in an Excel spreasheet. I import this data base using the following code: library(RODBC) db - C:/Users/Axel/Desktop/estimation/data.xls channel - odbcConnectExcel(xls.file = db) data - sqlFetch(channel = channel, sqtable = Feuil1) data odbcClose(channel) Then I perform an lm regression using the following code: reg1 -lm(data$prod~data$pri+data$cli) summary(reg1) Then I try to perform a gls regression because I have a correlation problem. For this I use the following code: reg1gls - gls(data$prod ~ data$pri + data$cli + correlation=corAR1(form= ~data$Year), method='ML') The problem is that after this gls regression, I have the fellowing error message : Error in eval(expr, envir, enclos) : 'Year' object is not find When I relplace Year by 1 in the gls formula, I have a second error message Error in eval(expr, envir, enclos) : 'prod' object is not find So I do not understand why R is able to extract variable from my data base with an lm object but it is not able to do it with the gls object. Do you have an idea about this problem? Many thanks in advance. [[alternative HTML version deleted]] __ 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] R^2 extraction and autocorrelation/heterokedasticity on TSLS regression
Hi, Â I'm actually Iâm performing a TSLS linear multiple regression on annually data which go from 1971 to 1997. After performing the TSLS regression, I tried to extract the R squared value using âoutput$r.squaredâ function and to perform autocorrelation (Durbin Watson and Breush Godfrey) and heterokedasticity tests (Breush-pagan and Goldfeld Quandt)Â but I have errors messages. More specifically, this is function that I write to R and below its response : for R^2 : output$r.squared NULL for heterokedasticity tests : bptest(reg1) Error in terms.default(formula) : no terms component and for autocorrelation test, when I try : durbin.watson(reg1$residuals, max.lag=10) Â [1] 1.509 2.520 2.247 2.001 1.743 1.092 1.392 1.439 1.468 1.035 this give me only the durbin watson value and not the probabilities (p-value) When performing these tests on lm object I have no problem. So my question is how to extract R^2 from a tsls regression (object) and how to perform autocorrelation and heterokedasticity tests on tsls regression. I looked at the sem package but I found no answer to my questions. So please is there any person who can help me. Â Think you in advance [[alternative HTML version deleted]] __ 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.