R Functions

Here is a growing collection of some (I think) handy R functions that I have written. I plan to complete some better documentation when the time becomes available.


Functions (use sidebar to navigate) Click on titles for code

calcBy - Similar to bysort in stata...I haven't found a simple function that does what this function does (see file for instructions).

plm - Runs a semiparametric Partial Linear differencing Model (outlined in Yatchew 1997 and 1998) that allows for nonparametric estimation of the relationship between one independent variable and outcome, while controlling (linearly) for a vector of other influences.

balance - This is a handy function for analyses that use the Match function. One of the best features of this function is that it returns a simple data frame of balancing results that can easily be copy and pasted into Excel for the comparison of many matching specifications (those that use Match know that, while very thorough, Sekhon's balance function is not practical for comparing across specifications). Among other features, the function will return a data frame of matched treated and control units that result from Match. See file for more information.

countif - Function evaluates a logical expression and returns the number of elements that meet and do not meet the condition. Convenient for complex expressions. Function also will return a data frame with the elements of the original data that meet the specified condition.

PLM Plot Power Analysis Example new plmplot

Contact SBE
Contact SSU
Sonoma State University School of Business and Economics. Reach.
1801 East Cotati Avenue, Rohnert Park, CA, 94928 • 707-664-2377