# R Programming/Index

This page provides tables which make it easy to find functions for usual tasks in statistics in R, SAS and Stata. Other software may also be included in the future such as SPSS.

## Data management Edit

Function | R | Stata | SAS |
---|---|---|---|

Merge | merge() | merge / mmerge | - |

Reshape | reshape() | reshape | - |

Expand a dataset | expand() (epicalc) |
expand | - |

## Descriptive Statistics Edit

Function | R | Stata | SAS |
---|---|---|---|

Mean | mean() | mean | proc means |

Histogram | hist() | hist | - |

Frequency table | table() | ta | proc freq |

## Regression models Edit

Function | R | Stata | SAS |
---|---|---|---|

Least Square | lm() | reg | proc reg |

GLM | glm() | glm | proc glm |

Probit models | glm(, family = binomial(link="probit")) | probit | - |

Logit models | glm(, family = binomial(link="logit")) | logit | - |

Linear fixed effects model | plm( , model = "within") (plm) |
xtreg , fe | - |

Linear random effects model | plm( , model = "random") (plm) |
xtreg , re | - |

Linear quantile regression | rq() (quantreg) |
qreg | - |

Ordinal logistic regression | polr() (MASS) |
ologit | - |

Linear IV (2sls) | ivreg() (AER) |
ivreg | proc syslin (2sls) - |

## Programming Edit

Function | R | Stata | SAS |
---|---|---|---|

Check some condition | stopifnot() | assert | - |