Collider Example

library (MASS)
covar<-mvrnorm(250, c(0, 0), matrix(c(1, 0.00, 0.00, 1), 2, 2))
mydata<-data.frame(covar)
names(mydata)<-c("sat", "mot")
mydata$admin<- mydata$sat + mydata$mot
mydata$admin2<- ifelse (mydata$admin >=quantile(mydata$admin, .85), "pass", "fail")
 
library(ggplot2)
qplot(sat,mot, data = mydata, color = admin2)

Created by Pretty R at inside-R.org

Advertisements

About Philip Parker

I am a post doc in developmental and educational psychology at a Germany university. I did my PhD at the university of Sydney in stress and well-being. Most days I am hunched over a computer yelling at statistical software or responding to journal editors who seem to always want twice the amount of content but with half the words. For fun I like to read up on the latest developments in R and programming various functions.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s