search for: demean

Displaying 20 results from an estimated 76 matches for "demean".

2007 Nov 23
4
help pleaseeeeeeeee
...putational work I encountered unexpected behavior when calling "ar" function, namely # time series x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar<-ar(x,aic=TRUE,demean=F) # call "ar" again and ............ res.ar<-ar(x,aic=TRUE,demean=F) Error in if (order > 0) coefs[order, 1:order] else numeric(0) : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In log(var.pred) : NaNs produced 2: In if (order > 0) coefs[order, 1:or...
2007 Nov 24
1
Bug in package stats function ar() (PR#10459)
...error sporadically. Several calls to ar() may be necessary to trip the error condition. Code to reproduce: x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar<-ar(x,aic=TRUE,demean=F) # call "ar" again and ............ res.ar<-ar(x,aic=TRUE,demean=F) Example output: (Note that on this attempt the first call to ar() tripped the error.) > x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- + 1.7783313,0.2728676,-0.3273164),start=c(197...
2013 Mar 14
0
Demean argument in ar function
Hello, I understand that the/ demean/ argument in the *ar()* function to fit an autoregressive model selects the best AR model fitted to the mean deleted observations. What is the purpose of using this demean procedure at all? Its seems silly as the post doesn't deal with R problems.... Thanks -- View this message in context: h...
2012 Feb 07
1
fixed effects with clustered standard errors
..."fe" option, or areg with the "absorb" option and in both case the clustering is achieved with "vce(cluster id)" My question is : how could I do that with R ? An important point is that I have too many individuals, therefore I cannot include dummies and should use the demeaning "usual" procedure. I tried with the plm package with the "within" option, but R quikcly tells me that the memory limits are attained (I have over 10go ram!) while the dataset is only 700mo (about 50 000 individuals, highly unbalanced) I dont understand... plm do indeed demean...
2013 Jan 11
0
Manual two-way demeaning of unbalanced panel data (Wansbeek/Kapteyn transformation)
Dear R users, I wish to manually demean a panel over time and entities. I tried to code the Wansbeek and Kapteyn (1989) transformation (from Baltagi's book Ch. 9). As a benchmark I use both the pmodel.response() and model.matrix() functions in package plm and the results from using dummy variables. As far as I understood the transfo...
2011 Mar 29
1
Simple AR(2)
...d to learn how to do it in R and check that it would give us the same autoregressive coefficients as the direct inversion method. So as first step in R we have initially applied the OLS method and obtained the following autoregression coefficients: > ar(x, method="ols", order.max=2, demean=FALSE, intercept=TRUE) Call: ar(x = x, order.max = 2, method = "ols", demean = FALSE, intercept = TRUE) Coefficients: 1 2 0.8049 0.0834 Intercept: 1.103 (0.2321) Order selected 2 sigma^2 estimated as 0.009756 Those are very close to the ones obtained with the dir...
2007 Mar 09
0
time demean model matrix
Suppose I have longitudinal data and want to use the econometric strategy of "de-meaning" a model matrix by time. For sake of illustration 'mat' is a model matrix for 3 individuals each with 3 observations where ``1'' denotes that individual i was in group j at time t or ``0'' otherwise. mat <- matrix(c(1,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,1,0,0,0,1,1,0),
2012 Feb 07
1
fixed effects linear model in R
...quot;fe" option, or areg with the "absorb" option and in both case the clustering is achieved with "vce(cluster id)" My question is : how could I do that with R ? An important point is that I have too many individuals, therefore I cannot include dummies and should use the demeaning "usual" procedure. I tried with the plm package with the "within" option, but R quikcly tells me that the memory limits are attained (I have over 10go ram!) while the dataset is only 700mo (about 50 000 individuals, highly unbalanced) I dont understand... plm do indeed demean...
2004 Jan 22
1
spectrum
Dear R users I have two questions about estimating the spectral power of a time series: 1) I came across a funny thing with the following code: data(co2) par(mfrow=c(2,1)) co2.sp1<-spectrum(co2,detrend=T,demean=T,span=3) co2.sp2<-spectrum(co2[1:468],detrend=T,demean=T,span=3) The first plot displays the frequencies ranging from 0 to 6 whearas the second plot displays the same curve but with frequencies between 0 and .5 although it is based on the same data (length(co2)=468). Why does the selection (co...
2018 Feb 20
1
"Within" model in plm package: is the reported R-squared correct?
Hi everyone, I am doing panel data analysis using the 'plm' package. However, I have noticed that the plm() function reports a different value of R-squared from the R-squared of the lm() function with time-demeaned data. To be clear, I have tried to compute the within model both manually (run an OLS regression with time-demeaned data using lm()) and by using plm(). The two methods give me 2 different values of R-squared and I am not sure which one is the correct one for the fixed-effect estimation. I am ne...
2006 Nov 13
1
bug in acf (PR#9360)
...ached. This is part a computation for a fast algorithm for exact mle of mean. Usually phi here are the coefficients from a high order AR but when I tried for AR(1) I got the error message. So the workaround is given. Notice that I use: p*as.vector(acf(phi,lag.max=p,type="covariance",demean=FALSE,plot=FALSE)$acf) so what I expect to get when p=length(phi)=1 is just phi^2. This is what happens in Mathematica with ListCorrelate[{phi},{phi}]. When you have acf="correlation" and demean=TRUE then one gets 0/0 which should be defined as 1 in this situation. Probably if the R a...
2007 Nov 27
1
help in ar function
...of the autoregressive approximation by AIC criterion and sometimes an error occurs. Example: # time series x<-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar<-ar(x,aic=TRUE,demean=F) # call "ar" again and ............ res.ar<-ar(x,aic=TRUE,demean=F) Error in if (order > 0) coefs[order, 1:order] else numeric(0) : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In log(var.pred) : NaNs produced 2: In if (order > 0) coefs[order, 1:o...
2012 May 03
0
error in La.svd Lapack routine 'dgesdd'
...o difficult for me to tell without output, references etc., although of course I trust D.B.'s opinion. For variables x,c,d,and e in object pdata_frame, I find that all sd() are reasonably similar both among the cross-sections as well as among the variables. However, I find that extracting the demeaned data from plm(), variables demXt$d and demXt$e (i.e. the demeaned variables) have sd()s that are very small compared to those of dem_yt and demXt$c (approx. by factor 1e-15). I extract the demeaned data as follows: dem_yt<-pmodel.response(res) demXt<-model.matrix(res) How is this possibl...
2019 Feb 14
0
Proposed speedup of spec.pgram from spectrum.R
...e function, therefore, calculating the lower left portion (ie when j < i) is not required. We change two nested loops to index from i:ncol(x) instead of 1L:ncol(x) : newspec.pgram <- function (x, spans = NULL, kernel = NULL, taper = 0.1, pad = 0, fast = TRUE, demean = FALSE, detrend = TRUE, plot = TRUE, na.action = na.fail, ...) { ## Estimate spectral density from (smoothed) periodogram. series <- deparse(substitute(x)) x <- na.action(as.ts(x)) xfreq <- frequency(x) x <- as.matrix(x) N <- N0 <- nrow(x)...
2005 Nov 28
3
How Can I change the acf's plot type?
In the R Document, the usage of the acf() is as follow: acf(x, lag.max = NULL, type = c("correlation", "covariance", "partial"), plot = TRUE, na.action = na.fail, demean = TRUE, ...) But now I want to get the result picture like: plot(x,type="l") or plot(x,type="p") How can I do this with acf function? 仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭佒伮 伬侎仯仭 仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭伖併佇伹 仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭guangxing at ict.ac.cn 仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭仭2005-11-28
2011 Aug 22
0
Did I find a bug on TSERIES or URCA packages?
I'm tring the functions to check the cointegration of a matrix. I'm using **Phillips & Ouliaris Cointegration Test** The function in *tseries* package is **po.test** and **ca.po** in *urca* The results with **URCA** are: > ca.po(prices, demean='none') ######################################## # Phillips and Ouliaris Unit Root Test # ######################################## Test of type Pu detrending of series none Call: lm(formula = z[, 1] ~ z[, -1] - 1) Residuals:...
2012 Mar 20
1
MA process in panels
...______________________ #Unfortunately, I was unable to create an appropriate panel dataset with an MA process in the residuals. Maybe someone has an idea where to find such data? Nevertheless you should be able to follow my subsequent thoughts: # I should be able to get my (time- and sectionally) demeaned series as follows: res1<-plm(x~c+v,data=pdata_frame, effect="twoways", model="within", na.action=na.omit)) dem_yt<-pmodel.response(res) demXt<-model.matrix(res) # Given the demeaned series, I need to set the first observation(s) in each cross-section to NA in order...
2010 Oct 14
1
robust standard errors for panel data - corrigendum
...the "big" dimension is some sort of nonparametric truncation. So: ** 1st (possible) solution ** In my opinion, you would actually need a panel implementation of Newey-West, which is not implemented in 'plm' yet. It might well be feasible by applying vcovHAC{sandwich} to the time-demeaned data but I'm not sure; in this case, vcovHAC should be applied this way (here: the famous Munnell data, see example(plm)) > library(plm) > fm<-log(gsp)~log(pcap)+log(pc)+log(emp)+unemp > data(Produc) > ## est. FE model > femod<-plm(fm, Produc) > ## extract time-demea...
2024 Feb 23
2
help - Package: stats - function ar.ols
...ski. escreveu: > > Hello, > > > > My name is Pedro and it is nice to meet you all. I am having trouble > > understanding a message that I receive when use function ar.ols from > > package stats, it says that "Warning message: > > In ar.ols(x = dtb[2:6966, ], demean = FALSE, intercept = TRUE, > > prewhite = TRUE) : > > model order: 2 singularities in the computation of the projection > > matrix results are only valid up to model order 1, which I do not know > > what it means, if someone could clarify it, I would really appreciate &g...
2002 Jan 15
1
acf conf intervals +speed
...(81 total combinations). It was easy enough to replace one of the while loops with a vector operation, but the others are tough. Anyone have either alternative code or a suggestion for how to replace the other loops below? Thanks initc<-function(x,y){ n<-min(length(x),length(y)) # -- Demean -- @ xm<-x-mean(x) ym<-y-mean(y) # -- Cross Products -- @ a<-xm*ym b<-xm*xm c<-ym*ym cx0<-mean(b) cy0<-mean(c) list(cx0=cx0,cy0=cy0) } corse<-function(x,y,cx0,cy0,mix=1){ # FROM code by stock and watson from HOM paper #corse.prc # 10/28/97, mww # Compute Co...