standard-error

R - Lattice xyplot - How do you add error bars to groups and summary lines?

こ雲淡風輕ζ 提交于 2019-11-28 02:11:02
问题 I'm posting this question because the very similar question here has not been answered until now. I have been asked to plot the mean +/- SEM of my whole cohort of patients over the xyplot() that depicts the values of all patients. The data used represents intraoperative cardiovascular findings from patients undergoing surgery. This is my data.frame called df dput(df) structure(list(Name = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 1L, 1L, 1L,

Extract standard errors from glm

五迷三道 提交于 2019-11-27 22:18:57
I did a glm and I just want to extract the standard errors of each coefficient. I saw on the internet the function se.coef() but it doesn't work, it returns "Error: could not find function "se.coef"" . The information you're after is stored in the coefficients object returned by summary() . You can extract it thusly: summary(glm.D93)$coefficients[, 2] #Example from ?glm counts <- c(18,17,15,20,10,20,25,13,12) outcome <- gl(3,1,9) treatment <- gl(3,3) print(d.AD <- data.frame(treatment, outcome, counts)) glm.D93 <- glm(counts ~ outcome + treatment, family=poisson()) #coefficients has the data

Different Robust Standard Errors of Logit Regression in Stata and R

元气小坏坏 提交于 2019-11-27 19:30:38
I am trying to replicate a logit regression from Stata to R. In Stata I use the option "robust" to have the robust standard error (heteroscedasticity-consistent standard error). I am able to replicate the exactly same coefficients from Stata, but I am not able to have the same robust standard error with the package "sandwich". I have tried some OLS linear regression examples; it seems like the sandwich estimators of R and Stata give me the same robust standard error for OLS. Does anybody know how Stata calculate the sandwich estimator for non-linear regression, in my case the logit regression?

Clustered standard errors in R using plm (with fixed effects)

丶灬走出姿态 提交于 2019-11-27 18:46:48
问题 I'm trying to run a regression in R's plm package with fixed effects and model = 'within' , while having clustered standard errors. Using the Cigar dataset from plm , I'm running: require(plm) require(lmtest) data(Cigar) model <- plm(price ~ sales + factor(state), model = 'within', data = Cigar) coeftest(model, vcovHC(model, type = 'HC0', cluster = 'group')) Estimate Std. Error t value Pr(>|t|) sales -1.21956 0.21136 -5.7701 9.84e-09 This is (slightly) different than what I'd get by using

Extract standard errors from glm

為{幸葍}努か 提交于 2019-11-27 04:33:59
问题 I did a glm and I just want to extract the standard errors of each coefficient. I saw on the internet the function se.coef() but it doesn't work, it returns "Error: could not find function "se.coef"" . 回答1: The information you're after is stored in the coefficients object returned by summary() . You can extract it thusly: summary(glm.D93)$coefficients[, 2] #Example from ?glm counts <- c(18,17,15,20,10,20,25,13,12) outcome <- gl(3,1,9) treatment <- gl(3,3) print(d.AD <- data.frame(treatment,