Monthly Archives: February 2011

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 … Continue reading

Posted in Uncategorized | Leave a comment

Stirling’s formula for R

I am sure it is out there but for my record keeping purposes and for anyone interested here is a quick function to find Stirling’s approximation of all possible permutations Stirling<- function (n)((2*pi*n)^.5)*(n/exp(1))^n Created by Pretty R at inside-R.org

Posted in Uncategorized | 1 Comment