Retrieving response variable in the probit

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Retrieving response variable in the probit

syen04
Can anyone tell me how to retrieve the response (dependent) variable
from a probit regression object (as much as model.matrix(obj)
retrieves the data matrix). Below is a self-runnable set of codes.
Thank you!

library(sampleSelection)
data<-read.csv("https://dl.dropboxusercontent.com/u/220037024/Yen/data/pta.csv")
eq1<-d~sex+age+educ
p1<-probit(eq1,data=data)
summary(p1)
attributes(p1)

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Retrieving response variable in the probit

Achim Zeileis-4
On Mon, 2 May 2016, Steven Yen wrote:

> Can anyone tell me how to retrieve the response (dependent) variable
> from a probit regression object (as much as model.matrix(obj)
> retrieves the data matrix). Below is a self-runnable set of codes.
> Thank you!
>
> library(sampleSelection)
> data<-read.csv("https://dl.dropboxusercontent.com/u/220037024/Yen/data/pta.csv")
> eq1<-d~sex+age+educ
> p1<-probit(eq1,data=data)
> summary(p1)
> attributes(p1)

model.frame(p1)

recovers the (possibly transformed) data employed for fitting the model
and

model.response(model.frame(p1))

extracts the response variable from that model frame.

> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.