glm() will handle fractional logit with some tweaks. below is copied from my blog in a python example. however, you should be able to see the R code from it.
In [12]: # Address the same type of model with R by Pyper In [13]: import pyper as pr In [14]: r = pr.R(use_pandas = True) In [15]: r.r_data = data In [16]: # Indirect Estimation of Discrete Dependent Variable Models In [17]: r('data <- rbind(cbind(r_data, y = 1, wt = r_data$LEV_LT3), cbind(r_data, y = 0, wt = 1 - r_data$LEV_LT3))') Out[17]: 'try({data <- rbind(cbind(r_data, y = 1, wt = r_data$LEV_LT3), cbind(r_data, y = 0, wt = 1 - r_data$LEV_LT3))})\n' In [18]: r('mod <- glm(y ~ COLLAT1 + SIZE1 + PROF2 + LIQ + IND3A, weights = wt, subset = (wt > 0), data = data, family = binomial)') Out[18]: 'try({mod <- glm(y ~ COLLAT1 + SIZE1 + PROF2 + LIQ + IND3A, weights = wt, subset = (wt > 0), data = data, family = binomial)})\nWarning message:\nIn eval(expr, envir, enclos) : non-integer #successes in a binomial glm!\n' In [19]: print r('summary(mod)') try({summary(mod)}) Call: glm(formula = y ~ COLLAT1 + SIZE1 + PROF2 + LIQ + IND3A, family = binomial, data = data, weights = wt, subset = (wt > 0)) Deviance Residuals: Min 1Q Median 3Q Max -1.0129 -0.4483 -0.3173 -0.1535 2.5379 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -7.24979 0.56734 -12.779 < 2e-16 *** COLLAT1 1.23715 0.26012 4.756 1.97e-06 *** SIZE1 0.35901 0.03746 9.584 < 2e-16 *** PROF2 -3.14313 0.73895 -4.254 2.10e-05 *** LIQ -1.38249 0.35749 -3.867 0.00011 *** IND3A 0.54658 0.14136 3.867 0.00011 *** --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 2692.0 on 5536 degrees of freedom Residual deviance: 2456.4 on 5531 degrees of freedom AIC: 1995.4 Number of Fisher Scoring iterations: 6 On Sun, Feb 3, 2013 at 11:17 AM, Rachael Garrett <rachaeldgarr...@gmail.com>wrote: > Hi, > > Does anyone know of a function in R that can handle a fractional variable > as the dependent variable? The catch is that the function has to be > inclusive of 0 and 1, which betareg() does not. > > It seems like GLM might be able to handle the fractional logit model, but > I can't figure it out. How do you format GLM to do so? > > Best, > > Rachael > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- ============================== WenSui Liu Credit Risk Manager, 53 Bancorp wensui....@53.com 513-295-4370 ============================== [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.