meantab | R Documentation |

Function for tabulating the means and other basic statistics useful to assess covariate balance after matching.

meantab(X_mat, t_ind, t_id, c_id, exact = NULL, digits = 2)

`X_mat` |
matrix of covariates: a matrix of covariates used to assess balance. |

`t_ind` |
treatment indicator: a vector of zeros and ones indicating treatment (1 = treated; 0 = control). |

`t_id` |
a vector of indexes of the treated units. |

`c_id` |
a vector of indexes of the matched controls. |

`exact` |
a vector of characters equal to "f" or "w" indicating whether Fisher's exact test or Wilcoxon rank-sum test should be used for binary (or categorical) and continous covariates, respectively. Otherwise, if exact |

`digits` |
a scalar indicating the number of digits to display in the columns of the table. |

`meantab`

is a function for tabulating the means and other basic statistics useful to assess covariate balance after matching.

A table with the following columns:

`Mis` |
proportion of missing values for each covariate; |

`Min` |
minimum value for each covariate; |

`Max` |
maximum value for each covariate; |

`Mean T` |
mean of the treated units for each covariate; |

`Mean C` |
mean of the matched controls for each covariate; |

`Std Dif` |
standardized differences in means after matching for each covariate; |

`P-val` |
P-values for t-tests for differences in means between treated units and matched controls for each covariate. |

# Load data data(germancities) # Sort and attach data germancities = germancities[order(germancities$treat, decreasing = TRUE), ] attach(germancities) # Treatment indicator t_ind = treat # Indexes of the treated units t_id = which(t_ind == 1) # Matrix of covariates X_mat = cbind(log2pop, popgrowth1939, popgrowth3339, emprate, indrate, rubble, rubblemiss, flats, flatsmiss, refugees) # Indices of the matched controls (obtained using bmatch in designmatch) c_id = c(67, 75, 39, 104, 38, 93, 79, 59, 64, 55, 106, 99, 97, 61, 82, 57, 76, 47, 46, 49) # meantab meantab(X_mat, t_ind, t_id, c_id) # meantab meantab(X_mat, t_ind, t_id, c_id, exact = c(rep("w", 6), "f", "w", "f", "w"), digits = 3)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.