
Recent Posts
Archives
Categories
Meta
Author Archives: Philip Parker
Function for Scaled Difference Tests (chisquare and logliklihood values)
#For use when comparing the fit of nested models with complex data, # (e.g. TYPE = COMPLEX is mplus) # The Scaled Difference Chisquare Test Statistic can be found at #http://preprints.stat.ucla.edu/260/chisquare.pdf # This function provides scaled differences tests based on … Continue reading
Posted in Uncategorized
Leave a comment
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 insideR.org
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 insideR.org
Posted in Uncategorized
1 Comment
Pseudo R Square Values in R
R does not give a Pseudo R square value and neither does Mplus. As such, here is a real quick R function to calculate McFadden’s and Adjusted McFadden’s Pseudo R square value: #Pesudo R square #x = full model … Continue reading
Posted in Uncategorized
2 Comments
Additional Functions for the MatchIt Package – Part 2
I have reworked the graphing and summarizing functions I wrote for the matchit package to be cleaner and to provide more information. Currently I have functions for a sorted by size summary table of the post matching mean differences: meandifftable< … Continue reading
Posted in Uncategorized
Leave a comment
Simplified Output for Matchit package
Have been attending a seminar on propensity score matching this week, when I was asked if I could write a function to reduce the complexity of the matchit package output. I produced two functions. First I wrote a function to … Continue reading
Posted in Uncategorized
Leave a comment
Displaying Kmeans Results.
I am a fan of Kmeans approaches to clustering data particularly when you have a theoretical reason to expect a certain number of clusters and you have a large data set. However, I think ploting the cluster means can be … Continue reading
Posted in Uncategorized
1 Comment