Learn R Programming

weights (version 1.1.1)

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.1

License

GPL (>= 2)

Maintainer

Josh Pasek

Last Published

June 10th, 2025

Functions in weights (1.1.1)

wtd.anova

Weighted one-way ANOVA
wtd.violinplot

Draw weighted violin plots by group
wtd.xtab

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

Computes weighted partial correlations, controlling for covariates
wtd.partial.cov

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

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

Weighted quantiles
stdz

Standardizes any numerical vector, with weights.
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
nalevs

Recode variables to 0-1 scale
starmaker

Produce stars from p values for tables.
anes04

Demographic Data From 2004 American National Election Studies (ANES)
dummify

Separate a factor into separate dummy variables for each level.
coeffer

Extract model coefficients with standard errors and significance stars
findn

Summarize key model information including sample size and fit statistics
onetable

Create a clean regression summary table from one or more models
wtd.cors

Produces weighted correlations quickly using C.
wtd.barplot

Weighted barplot
wpct

Provides a weighted table of percentages for any variable.
wtd.chi.sq

Produces weighted chi-squared tests.
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.
wtd.hist

Weighted Histograms
wtd.cov

Produces weighted covariances with standard errors and significance.
wtd.median

Weighted median
wtd.boxplot

Weighted boxplot