Jürgen Biedermann
2010-Nov-13 12:43 UTC
[R] Define a glm object with user-defined coefficients (logistic regression, family="binomial")
Hi there, I just don't find the solution on the following problem. :( Suppose I have a dataframe with two predictor variables (x1,x2) and one depend binary variable (y). How is it possible to define a glm object (family="binomial") with a user defined logistic function like p(y) = exp(a + c1*x1 + c2*x2) where c1,c2 are the coefficents which I define. So I would like to do no fitting of the coefficients. Still, I would like to define a GLM object because I could then easily use other functions which need a glm object as argument (e.g. I could use the anova, summary functions). Thank you very much! Greetings J?rgen -- ----------------------------------- J?rgen Biedermann Bl?cherstra?e 56 10961 Berlin-Kreuzberg Mobil: +49 176 247 54 354 Home: +49 30 250 11 713 e-mail: juergen.biedermann at gmail.com
David Winsemius
2010-Nov-13 16:15 UTC
[R] Define a glm object with user-defined coefficients (logistic regression, family="binomial")
On Nov 13, 2010, at 7:43 AM, J?rgen Biedermann wrote:> Hi there, > > I just don't find the solution on the following problem. :( > > Suppose I have a dataframe with two predictor variables (x1,x2) and > one depend binary variable (y). How is it possible to define a glm > object (family="binomial") with a user defined logistic function > like p(y) = exp(a + c1*x1 + c2*x2) where c1,c2 are the coefficents > which I define. So I would like to do no fitting of the > coefficients. Still, I would like to define a GLM object because I > could then easily use other functions which need a glm object as > argument (e.g. I could use the anova,The anova results would have not much interpretability in this setting. You would be testing for the Intercept being zero under very artificial conditions. You have eliminated much statistical meaning by forcing the form of the results.> summary functions).# Assume dataframe name is dfrm with variables event, no_event, x1, x2, and further assume c1 and c2 are also defined: dfrm$logoff <- with(dfrm, log(c1*x1 + c2*x2)) forcedfit <- glm( c(event,no_event) ~ 1 + offset(logoff), data=dfrm) (Obviously untested.)> > Thank you very much! Greetings > J?rgen > > -- > ----------------------------------- > J?rgen BiedermannDavid Winsemius, MD West Hartford, CT
Possibly Parallel Threads
- cross-validation complex model AUC Nagelkerke R squared code
- How to specify "newdata" in a Cox-Modell with a time dependent interaction term?
- Count number of different patterns (Polytomous variable)
- How to use the paste function to create an already used variable
- Memory Page Sharing on Xen 4.0.1