I don't have a logistic regression model and am trying to generate
probability curves for all possible combinations of
the variables. My logit model has 5+ variables, and I want to draw curves
for every scenario.

See code below. When home_owner is 0 and 1, I want curves. The same goes
for all other variables categories, so that
I have permutations for all possible combinations.

I've found that I can use the TeachingDemos package (see below) to
construct a gui which makes this easier, but I want to form
curve separately so that I can save them

library(TeachingDemos)
TkPredict(mod1)

Predict.Plot(mod1, pred.var = "our_bid", our_bid = c(0,300),
age_of_oldest_driver2 = "18 to 21",
             credit_type2 = "POOR", coverage_type2 = "BASIC", home_owner2 =
"0",
             state2 = "other", currently_insured2 = "0",
vehicle_driver_score = "0",
             plot.args = "list()", type = "response")


Quick reproduceable example =
df = data.frame(sell=c("0","1","0","0","1"),
home=c("own","rent","rent","rent","own"),
                income=c(50,20,20,50,50), gender=c("M","M","F","F","F"))
df$sell = as.factor(df$sell)
df$home = as.factor(df$home)
df$income = as.factor(df$income)
df$gender = as.factor(df$gender)
str(df)
m1 = glm(factor(sell) ~ home + income + gender,
           data=df, family=binomial(link="logit"))

summary(m1)

library(TeachingDemos)
TkPredict(m1)

Thanks

-- 
*Abraham Mathew
Statistical Analyst
www.amathew.com
720-648-0108
@abmathewks*

        [[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.

Reply via email to