glm

Fractional logit model in R [closed]

会有一股神秘感。 提交于 2019-12-03 04:44:20
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I would like to estimate covariate effects on a response whose values take on values in [0,1]. That is, the values of the response variable live between 0-1 (inclusive). I would like to use the fractional logit model described by Papke and Wooldridge (1996), see below: http://faculty.smu.edu/millimet/classes

Extract pvalue from glm

无人久伴 提交于 2019-12-02 21:53:24
I'm running many regressions and am only interested in the effect on the coefficient and p-value of one particular variable. So, in my script, I'd like to be able to just extract the p-value from the glm summary (getting the coefficient itself is easy). The only way I know of to view the p-value is using summary(myReg). Is there some other way? e.g.: fit <- glm(y ~ x1 + x2, myData) x1Coeff <- fit$coefficients[2] # only returns coefficient, of course x1pValue <- ??? I've tried treating fit$coefficients as a matrix, but am still unable to simply extract the p-value. Is it possible to do this?

How do I extract lmer fixed effects by observation?

强颜欢笑 提交于 2019-12-02 21:20:31
I have a lme object, constructed from some repeated measures nutrient intake data (two 24-hour intake periods per RespondentID): Male.lme2 <- lmer(BoxCoxXY ~ -1 + AgeFactor + IntakeDay + (1|RespondentID), data = Male.Data, weights = SampleWeight) and I can successfully retrieve the random effects by RespondentID using ranef(Male.lme1) . I would also like to collect the result of the fixed effects by RespondentID . coef(Male.lme1) does not provide exactly what I need, as I show below. > summary(Male.lme1) Linear mixed model fit by REML Formula: BoxCoxXY ~ AgeFactor + IntakeDay + (1 |

Fractional logit model in R [closed]

一世执手 提交于 2019-12-02 17:55:47
I would like to estimate covariate effects on a response whose values take on values in [0,1]. That is, the values of the response variable live between 0-1 (inclusive). I would like to use the fractional logit model described by Papke and Wooldridge (1996), see below: http://faculty.smu.edu/millimet/classes/eco6375/papers/papke%20wooldridge%201996.pdf Is there an R function (or library) to facilitate estimation of the fractional logit model? Could I modify glm() in some way? Edited question starts here I appreciate @Jibler's comment - this gets at the estimated beta's from the fractional

Warning: non-integer #successes in a binomial glm! (survey packages)

余生长醉 提交于 2019-12-02 17:28:56
I am using the twang package to create propensity scores, which are used as weights in a binomial glm using survey::svyglm . The code looks something like this: pscore <- ps(ppci ~ var1+var2+.........., data=dt....) dt$w <- get.weights(pscore, stop.method="es.mean") design.ps <- svydesign(ids=~1, weights=~w, data=dt,) glm1 <- svyglm(m30 ~ ppci, design=design.ps,family=binomial) This produces the following warning: Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm! Does anyone know what I could be doing wrong ? I wasn't sure if this message would be better

Cross validation for glm() models

浪子不回头ぞ 提交于 2019-12-02 17:19:05
I'm trying to do a 10-fold cross validation for some glm models that I have built earlier in R. I'm a little confused about the cv.glm() function in the boot package, although I've read a lot of help files. When I provide the following formula: library(boot) cv.glm(data, glmfit, K=10) Does the "data" argument here refer to the whole dataset or only to the test set? The examples I have seen so far provide the "data" argument as the test set but that did not really make sense, such as why do 10-folds on the same test set? They are all going to give exactly the same result (I assume!).

Does Quasi Separation matter in R binomial GLM?

自古美人都是妖i 提交于 2019-12-02 17:16:32
问题 I am learning how the quasi-separation affects R binomial GLM. And I start to think that it does not matter in some circumstance . In my understanding, we say that the data has quasi separation when some linear combination of factor levels can completely identify failure/non-failure. So I created an artificial dataset with a quasi separation in R as: fail <- c(100,100,100,100) nofail <- c(100,100,0,100) x1 <- c(1,0,1,0) x2 <- c(0,0,1,1) data <- data.frame(fail,nofail,x1,x2) rownames(data) <-

caret train() predicts very different then predict.glm()

丶灬走出姿态 提交于 2019-12-02 13:55:19
I am trying to estimate a logistic regression, using the 10-fold cross-validation. #import libraries library(car); library(caret); library(e1071); library(verification) #data import and preparation data(Chile) chile <- na.omit(Chile) #remove "na's" chile <- chile[chile$vote == "Y" | chile$vote == "N" , ] #only "Y" and "N" required chile$vote <- factor(chile$vote) #required to remove unwanted levels chile$income <- factor(chile$income) # treat income as a factor Goal is to estimate a glm - model that predicts to outcome of vote "Y" or "N" depended on relevant explanatory variables and, based on

Does Quasi Separation matter in R binomial GLM?

坚强是说给别人听的谎言 提交于 2019-12-02 11:35:33
I am learning how the quasi-separation affects R binomial GLM. And I start to think that it does not matter in some circumstance . In my understanding, we say that the data has quasi separation when some linear combination of factor levels can completely identify failure/non-failure. So I created an artificial dataset with a quasi separation in R as: fail <- c(100,100,100,100) nofail <- c(100,100,0,100) x1 <- c(1,0,1,0) x2 <- c(0,0,1,1) data <- data.frame(fail,nofail,x1,x2) rownames(data) <- paste("obs",1:4) Then when x1=1 and x2=1 (obs 3) the data always doesn't fail. In this data, my

Loop for glm model with changing number of variables

前提是你 提交于 2019-12-02 08:43:20
问题 I have a dataset with 1-3 versions of the dependent variable, and 10-15 independent variables. I'd like to run a glm command for the model, but would like it to loop for ALL possible combinations of independent variables. I've never written code for a loop, and want to make sure I set it up correctly. Below is a small subset of my data frame. The actual dataframe has an explicit name for each variable; not just "DepVar1" or "IndVar1." dfPRAC <- structure(list(DepVar1 = c(0, 0, 0, 0, 1, 0, 0,