Learn R Programming

weights (version 1.1.2)

Weighting and Weighted Statistics

Description

Provides a variety of functions for producing simple weighted statistics, such as weighted Pearson's correlations, partial correlations, Chi-Squared statistics, histograms, and t-tests as well as simple weighting graphics including weighted histograms, box plots, bar plots, and violin plots. Also includes software for quickly recoding survey data and plotting estimates from interaction terms in regressions (and multiply imputed regressions) both with and without weights and summarizing various types of regressions. Some portions of this package were assisted by AI-generated suggestions using OpenAI's GPT model, with human review and integration.

Copy Link

Version

Install

install.packages('weights')

Monthly Downloads

8,131

Version

1.1.2

License

GPL (>= 2)

Maintainer

Josh Pasek

Last Published

June 18th, 2025

Functions in weights (1.1.2)

wtd.xtab

Weighted cross-tabulations using up to three categorical variables
wtd.boxplot

Weighted boxplot
wtd.partial.cov

Computes weighted partial covariances, controlling for covariates
wtd.violinplot

Draw weighted violin plots by group
wtd.partial.cor

Computes weighted partial correlations, controlling for covariates
wtd.t.test

Produces weighted Student's t-tests with standard errors and significance.
nalevs

Recode variables to 0-1 scale
onetable

Create a clean regression summary table from one or more models
rd

Round Numbers To Text With No Leading Zero
plotwtdinteraction

Functions to Identify and Plot Predicted Probabilities As Well As Two- and Three-Way Interactions From Regressions With or Without Weights and Standard Errors
anes04

Demographic Data From 2004 American National Election Studies (ANES)
wtd.median

Weighted median
wpct

Provides a weighted table of percentages for any variable.
wtd.barplot

Weighted barplot
findn

Summarize key model information including sample size and fit statistics
dummify

Separate a factor into separate dummy variables for each level.
wtd.chi.sq

Produces weighted chi-squared tests.
coeffer

Extract model coefficients with standard errors and significance stars
wtd.hist

Weighted Histograms
wtd.anova

Weighted one-way ANOVA
wtd.cor

Produces weighted correlations with standard errors and significance. For a faster version without standard errors and p values, use the wtd.cors function.
starmaker

Produce stars from p values for tables.
stdz

Standardizes any numerical vector, with weights.
wtd.cors

Produces weighted correlations quickly using C.
wtd.cov

Produces weighted covariances with standard errors and significance.