An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120708/9514bac4/attachment.pl>
Using the effects package
2 messages · Abraham Mathew, John Fox
Dear Abraham, I must admit that I don't really follow what you want to do. Disregarding the fact that the example you provide doesn't converge to a proper solution, the plot that you've requested will range over all values of bid at the median home, which is 0. You may have intended home to be a categorical variable, but you've specified it as numeric rather than a factor, and so effect() treats it as numeric. If you want to display the fit at all combinations of values of the two predictors, give the first argument to effect as "bid:home", even though this isn't a term in the model, the two terms bid and home are marginal to it. I hope that this helps, though I doubt it, since, as I said, I don't think that I understand what you want to do. John ------------------------------------------------ John Fox Sen. William McMaster Prof. of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ On Sun, 8 Jul 2012 21:03:47 -0600
Abraham Mathew <abmathewks at gmail.com> wrote:
I've been looking into the effects package and it seems to be a great tool
for plotting the probabilities of the
response variable by the predictors. However, I'm wonder if I can use the
effects package to plot the probabilities
on the y axis and one predictor on the x axis, with the curve having the
info for another predictor.
So let's say our response variable is win, a binary variable. There are two
predictors, home (categorical) and
bid (continuous). For both home and bid, I want to generate plots showing
the predicted probabilities for all
the "levels" of that variable.
For bid, that means the probability for winning at all bid levels. For
home, the curve for the probability for winning
at each level.
df <- data.frame(won=c(1,0,1,0,1,0,0,0,0,1),
bid=c(150,200,135,140,130,150,200,135,140,130),
home=c(1,0,0,0,1,1,0,0,0,1))
df
m1 = glm(won ~ bid + home, data=df, family=binomial(link="logit"))
summary(m1)
eff <- effect("bid", m1, xlevels=list(bid=df$bid), typical="median")
print(plot(eff, rescale.axis=F))
The thing I'm concerned about is the curve for home. For any logit
equation, say with a coefficient of 2.5, that is the
log odds change in Y regardless of the values of the other predictors. So
I'm not sure I'm doing the write thing in that
context.
Can anyone help.
Thanks
*
*
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.