search for: coeftest

Displaying 20 results from an estimated 51 matches for "coeftest".

2009 Dec 10
2
Problem with coeftest using Newey West estimator
Hi, I want to calculate the t- and p-values for a linear model using the Newey West estimator. I tried this Code and it usually worked just fine: > oberlm <- lm(DYH ~ BIP + Infl + EOil, data=HU_H) > coeftest(oberlm, NeweyWest(oberlm, lag=2)) t test of coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.1509950 0.0743832 2.0300 0.179486 BIP -5.5131683 1.2536813 -4.3976 0.048016 * Infl -0.0623530 0.0036215 -17.2175 0.003356 ** EOil...
2011 Feb 25
1
Question about foreach (with doSNOW), is that a bug?
...y other solutions? Here's an example about what i said: # install.packages("lmtest") # install.packages("doSNOW") require(lmtest) require(foreach) require(doSNOW) rm(list=ls(all=TRUE)) # load the data data(Mandible) # run the OLS and compute the SD # no problem at all coeftest(lm(length ~ age, data=Mandible, subset=(age <= 28))) # Do the same thing twice with foreach # no problem at all foreach(i=1:2) %do% { coeftest(lm(length ~ age, data=Mandible, subset=(age <= 28))) } # Do the same thing twice with foreach and doSNOW # it fails!! the error msg was (could n...
2011 Nov 23
0
Error using coeftest() with a heteroskedasticity-consistent estimation of the covar.
Hey I am trying to run /coeftest()/ using a heteroskedasticity-consistent estimation of the covariance matrix and i get this error: # packages >library(lmtest) >library(sandwich) #test > coeftest(*GSm_inc.pool*, vcov = vcovHC(*GSm_inc.pool*, method="arellano", > type="HC3")) /Fehler in 1 - diaghat...
2013 Mar 30
1
vcovHC and arima() output
Dear all, how can I use vcovHC() to get robust/corrected standard errors from an arima() output? I ran an arima model with AR(1) and got the estimate, se, zvalue and p-value using coeftest(arima.output). However, I cannot use vcovHC(arima.output) to get corrected standard errors. It seems vcovHC works only with lm and plm objects? Is there another way I can get robust/corrected standard errors, or am I missing something? Thank you! Nicole -- I got this error: >...
2011 Jul 25
1
predict() and heteroskedasticity-robust standard errors
Hello there, I have a linear regression model for which I estimated heteroskedasticity-robust (Huber-White) standard errors using the coeftest function in the lmtest-package. Now I would like to inspect the predicted values of the dependent variable for particular groups and include a confidence interval for this prediction. My question: is it possible to estimate confidence intervals for the values predicted by a model with heteroskeda...
2007 Feb 20
0
Problems with obtaining t-tests of regression coefficients applying consistent standard errors after run 2SLS estimation. Clearer !!!!!
...g2 <- systemfit("2SLS", system, labels, Inst, saveMemory=TRUE) * *>summary (Reg2)* Now I want to obtain the t-tests of the coefficients but applying the HCSE. I know two different ways to obtain them: First, applying the function robcov() from package Design, or Second, applying coeftest() and vcovHV() from packages lmtest and sandwich. The program lines are the following: *Program lines 2:* *>#### First option: using robcov() ####* *>library (Design)* *>options(scipen=20)* *>robcov(Reg1) ### I tried with Reg 2 too* ** ** ** ***>####Second option: using coeft...
2009 Dec 08
1
Serial Correlation in panel data regression
...year=as.factor(Gasoline$year) Now I run the following regression rhs <- "-1 + f.year + lincomep+lrpmg+lcarpcap" m1<- lm(as.formula(paste("lgaspcar ~", rhs)), data=Gasoline) ###Now I want to find the autocorrelation,heteroskedasticity adjusted standard errors as a part of coeftest ### Basically I would like to take care of the within country serial correlaion ###that is I want to do coeftest(m1, vcov=function(x) vcovHAC(x,order.by=...)) Please suggest what should be the argument of order.by and whether that will give me the desired result [[alternative HTML version delet...
2011 Feb 16
1
VAR with HAC
Hello, I would like to estimate a VAR model with HAC corrected standard errors. I tried to do this by using the sandwich package, for example: > library(vars) > data(Canada) > myvar = VAR(Canada, p = 2, type = "const") > coeftest(myvar, vcov = vcovHAC) Error in umat - res : non-conformable arrays Which suggests that this function is not compatible with the VAR command. Has anyone tried to modify the code to get HAC corrected standard errors with VAR? Any suggestions are welcome. Thank you. Marta [[alternative HTML...
2009 Mar 10
1
HAC corrected standard errors
...nts this in R? It's a basic question and I'm sure I'm missing something obvious here. I looked up this post: http://www.nabble.com/Re%3A-Moving-Window-regressions-with-corrections-for-Heteroscedasticity-and-Autocorrelations(HAC)-td6075371.html#a6075371 which recommended that I use the coeftest() function in package lmtest, but when I tried to assign an object: result <- coeftest(regre, NeweyWest), where regre is an object of class lm, this returned an error. I'd be grateful for any advice, since I'm sure I'm making one of those simple bloopers. Thanks! Shruthi -- Vie...
2010 Jun 08
2
how to ignore rows missing arguments of a function when creating a function?
...= F) library(sandwich) library(lmtest) M <- length(unique(cluster)) N <- length(cluster) K <- fm$rank dfc <- (M/(M-1))*((N-1)/(N-K)) uj <- data.frame(apply(estfun(fm),2, function(x) data.frame(tapply(x, cluster, sum)) ) ); vcovCL <- dfc*sandwich(fm, meat=crossprod(uj)/N) coeftest(fm, vcovCL) } When I run my function, I get the message: Error in tapply(x, cluster, sum) : arguments must have same length If I specify instead attach(na.omit(dat), warn.conflicts = F) and don't have the "na.rm=TRUE" argument, then my function runs; but only for the rows wher...
2013 Jan 20
3
strucchange breakpoints r-squared
...output from a piecewise (segmented) regression using the strucchange package? Here is the R code I have tried thus far. library(lmtest) library(strucchange) data <- ts(c(rnorm(30), runif(30)), frequency = 12, start = c(2005, 01)) bpts <- breakpoints(data ~ 1) print(bpts) summary(bpts) coeftest(bpts) [[alternative HTML version deleted]]
2006 Aug 31
0
Moving Window regressions with corrections for Heteroscedasticity and Autocorrelations(HAC)
...gression with corrections for #Heteroscedasticity and Autocorrelations (HAC) using Newey West Method. This code is a #extension of Ajay Shah?s code for moving windows simple OLS regression. # The easiest way to adjust for Autocorrelations and Heteroscedasticity in the OLS residuals is to #use the coeftest function that is included in the ?lmtest? packages. # The ?lmtest? package includes the coeftest (model, NeweyWest) command which returns # the ?HAC? consistent estimators along with its standard error, t-stat and pvalue. # To implement the corrections for Heteroscedasticity and Autocorrelations...
2011 Jul 11
1
Robust vce for heckman estimators
When using function heckit() from package ‘sampleSelection’, is there anyway to make t-tests for the coefficients using robust covariance matrix estimator? By “robust” I mean something like if a had an object ‘lm’ called “reg” and then used: > coeftest(reg, vcov = vcovHC(reg)). I’m asking this because in Stata we could use function heckman and then use vce option “robust”. We could do the same for cluster. In a more general way, is there anyway to use another covariance matrix to make t-test (e.g. linear hypothesis) for heckit (selection) model...
2010 Mar 06
1
Robust SE for lrm object
I'm trying to obtain the robust standard errors for a multinomial ordered logit model: mod6 <- lrm(wdlshea ~ initdesch + concap + capasst + qualrat + terrain,data=full2) The model is fine but when I try to get the RSE I get an error. coeftest(mod6, vcov = vcovHAC(mod6)) Error in match.arg(type) : 'arg' should be one of “ordinary”, “score”, “score.binary”, “pearson”, “deviance”, “pseudo.dep”, “partial”, ........etc. I'm a novice R user and am not sure how to address this problem. I have also tried to use alternatives...
2007 Feb 21
0
Problems with obtaining t-tests of regression
Guillermo, I am dropping most of your mail because my answer is very generic. First, why doesn't it work as you tried it: technically speaking, coeftest() and the like expect to be feed an lm or a glm object and for this reason won't accept the result of systemfit(), which is a much different object. I suppose the same goes for the rest. Second, what can you do: I'd do at least one step by hand. a) as you have only one structural equation...
2010 Nov 03
2
getting p-values from fitted ARIMA
Hi I fitted an ARIMA model using the function arima(). The output consists of the fitted coefficients with their standard errors. However i need information about the significance of the coefficients, like p-values. I hope you can help me on that issue... ciao Stefan
2013 Apr 05
1
white heteroskedasticity standard errors NLS
Hello Is there any function to calculate White's standard errors in R in an NLS regression. The sandwich and car package do it but they need an lm object to calculate the error's. Does anyone have idea how to do it for an NLS object ? Regards The woods are lovely, dark and deep But I have promises to keep And miles before I go to sleep And miles before I go to sleep ----- [[alternative
2009 Mar 03
2
latex output of regressions with standardized regression coefficients and t-statistics based on Huber-White
...he final result should be one big table for several regressions with this data (and N, R^2). I found the mtable package, which does what I need for lm(...) regressions, lm.beta to output standardized coefficients and package "sandwich" to output the corrected t-statistics (using "coeftest(x, vcov = vcovHAC(x))"). What I couldn't figure out how to put that all together, so that I get a latex table with standardized regression coefficients and corrected t-statistics based on H-W sandwich. Is there a way to get this in R and if yes: how? Thanks in advance, Jan -- jasc...
2010 Sep 23
1
Newey West and Singular Matrix + library(sandwich)
thank you, achim. I will try chol2inv. sandwich is a very nice package, but let me make some short suggestions. I am not a good econometrician, so I do not know what prewhitening is, and the vignette did not explain it. "?coeftest" did not work after I loaded the library. automatic bandwidth selection can be a good thing, but is not always. as to my own little function, I like the idea of specifying my choice of overlapping periods. for me, the need often arises in a case of regressions in which the variables are mea...
2013 Oct 19
2
ivreg with fixed effect in R?
I want to estimate the following fixed effect model: y_i,t = alpha_i + beta_1 x1_t + beta_2 x2_i,tx2_i,t = gamma_i + gamma_1 x1_t + gamma_2 Z1_i + gamma_3 Z2_i I can use ivreg from AER to do the iv regression. fm <- ivreg(y_i,t ~ x1_t + x2_i,t | x1_t + Z1_i + Z2_i, data = DataSet) But, I'm not sure how can I add the fixed effects. Thanks! [[alternative HTML