robust

Robust Standard Errors: Poisson Panel Regression (pglm, lmtest)

我的未来我决定 提交于 2021-01-29 10:33:28
问题 As a non-statistician I reached my limit here: I try to fit a Poisson model for panel data (using pglm ) and I want to calculate robust standard errors (using lmtest ). My code currently looks like this: #poisson model (panel with year fixed effects): poisson_model <- pglm(y ~ a + b + c + factor(year), data = regression_data, model = "pooling", family = poisson, index = c("ID", "year")) #robust standard errors: robust_SE_model <- coeftest(poisson_model, vcov. = vcovHC(poisson_model, type =

Robust Standard Errors in lm() using stargazer()

戏子无情 提交于 2020-01-25 04:14:26
问题 I have read a lot about the pain of replicate the easy robust option from STATA to R to use robust standard errors. I replicated following approaches: StackExchange and Economic Theory Blog. They work but the problem I face is, if I want to print my results using the stargazer function (this prints the .tex code for Latex files). Here is the illustration to my problem: reg1 <-lm(rev~id + source + listed + country , data=data2_rev) stargazer(reg1) This prints the R output as .tex code (non

Is there PTHREAD_MUTEX_ROBUST equivalent in Mac OS X?

混江龙づ霸主 提交于 2019-12-23 19:26:27
问题 I'm using a pthread_mutex_t with PTHREAD_PROCESS_SHARED on a shared memory to do synchronization between different processes. The mutex maybe deadlocked if a process exits but leaves the mutex locked. There is a PTHREAD_MUTEX_ROBUST in POSIX standard. But it seems that Mac OS X does not support the PTHREAD_MUTEX_ROBUST . Is there some kind of mutex on Mac OS X that can be used on a shared memory, and to be used to synchronize cross processes, and to be robust in case of a process die without

R's sandwich package producing strange results for robust standard errors in linear model

只谈情不闲聊 提交于 2019-12-12 03:08:14
问题 I am trying to find heteroskedasticity-robust standard errors in R, and most solutions I find are to use the coeftest and sandwich packages. However, when I use those packages, they seem to produce queer results (they're way too significant). Both my professor and I agree that the results don't look right. Could someone please tell me where my mistake is? Am I using the right package? Does the package have a bug in it? What should I use instead? Or can you reproduce the same results in STATA?

Outliers with robust regression in R

巧了我就是萌 提交于 2019-12-11 02:48:11
问题 I am using the lmrob function in R using the robustbase library for robust regression. I would use it as, rob_reg<-lmrob(y~0+.,dat,method="MM",control=a1) . When i want to return the summary i use summary(rob_reg) and one thing robust regression do is identifying outliers in the data. A certain part of the summary output give me the following, 6508 observations c(49,55,58,77,104,105,106,107,128,134,147,153,...) are outliers with |weight| <= 1.4e-06 ( < 1.6e-06); which list all the outliers,

Find *most* common prefix of strings - a better way?

故事扮演 提交于 2019-12-08 03:24:10
问题 I have a list of keys ['foo_a','foo_b','foo_c','fnord'] All of the similar solutions here assume that you have no fnord 's in your text. I have this code that does the job: def detect_prefix(keys): PCT = 0.70 # cutof pre = '' l = len(keys) for i in range(0, len(max(keys, key=len))): keys = filter(lambda k: k.startswith(pre), keys) cnt = dict() for k in map(lambda k: k[i], keys): cnt.setdefault(k,0) cnt[k] +=1 if cnt[max(cnt)] / float(l) >= PCT: pre += max(cnt) else: break return pre I have a

MM robust estimation in ggplot2 using stat_smooth with method = “rlm”

喜欢而已 提交于 2019-12-06 06:08:34
问题 The function rlm (MASS) permits both M and MM estimation for robust regression. I would like to plot the smoother from MM robust regression in ggplot2, however I think that when selecting method = "rlm" in stat_smooth, the estimation method automatically chosen is the M type. Is there any way of selecting the MM type estimation technique for the rlm function through ggplot2? Here is my code: df <- data.frame("x"=c(119,118,144,127,78.8,98.4,108,50,74,30.4, 50,72,99,155,113,144,102,131,105,127

Error computing Robust Standard errors in Panel regression model (plm,R)

和自甴很熟 提交于 2019-12-05 06:14:43
问题 I am using the plm library to run fixed effect regressions and the sandwich,lmtest libraries to compute robust standard errors. I have no problem running the regressions, but in some instances when I go to compute the standard errors I get the following error: library(plm) library(sandwich) library(lmtest) fe_reg <- plm(y ~ x + I(x^2)+factor(date), data=reg_data, index=c("id","date"), model="within") coeftest(fe_reg, vcov.=vcovHC(fe_reg, type="HC1")) RRuntimeError: Error in solve.default

MM robust estimation in ggplot2 using stat_smooth with method = “rlm”

前提是你 提交于 2019-12-04 10:17:40
The function rlm (MASS) permits both M and MM estimation for robust regression. I would like to plot the smoother from MM robust regression in ggplot2, however I think that when selecting method = "rlm" in stat_smooth, the estimation method automatically chosen is the M type. Is there any way of selecting the MM type estimation technique for the rlm function through ggplot2? Here is my code: df <- data.frame("x"=c(119,118,144,127,78.8,98.4,108,50,74,30.4, 50,72,99,155,113,144,102,131,105,127,120,85,153,40.6,133), "y"=c(1.56,2.17,0.81,1.07,1.12,2.03,0.90,1.48,0.64, 0.91,0.85,0.41,0.55,2.18,1.49

Error computing Robust Standard errors in Panel regression model (plm,R)

烂漫一生 提交于 2019-12-03 20:58:33
I am using the plm library to run fixed effect regressions and the sandwich,lmtest libraries to compute robust standard errors. I have no problem running the regressions, but in some instances when I go to compute the standard errors I get the following error: library(plm) library(sandwich) library(lmtest) fe_reg <- plm(y ~ x + I(x^2)+factor(date), data=reg_data, index=c("id","date"), model="within") coeftest(fe_reg, vcov.=vcovHC(fe_reg, type="HC1")) RRuntimeError: Error in solve.default(crossprod(demX)) system is computationally singular: reciprocal condition number = 1.84726e-25 I do not