Re: [R] formatting data for predict()

2010-09-26 Thread Ista Zahn
Hi Andrew, My inclination would be to put all the variables in a data.frame instead of putting the predictors in a matrix. But if you want to continue down this road, you need to have a column named dat in a the data.frame that contains a matrix. I couldn't figure out how to do such a thing in a

[R] formatting data for predict()

2010-09-25 Thread Andrew Miles
I'm trying to get predicted probabilities out of a regression model, but am having trouble with the newdata option in the predict() function. Suppose I have a model with two independent variables, like this: y=rbinom(100, 1, .3) x1=rbinom(100, 1, .5) x2=rnorm(100, 3, 2) mod=glm(y ~ x1 +