Learn R Programming

⚠️There's a newer version (1.4.3) of this package.Take me there.

JWileymisc

An R package with general utility and convenience functions. Some of these are general functions that help using and exploring SEM style data. Others are more specific. This package has grown out of my own work, and is often to automate repetitive tasks.

Installation

To get the latest development version, use:

#install.packages("devtools")
library(devtools)

install_github("JWiley/JWileymisc")

To get the version on cran:

install.packages("JWileymisc")

Examples

I do not have any vignettes or demos for this package. However, the functions are documented and I have included examples in the function documentation that are relatively basic. Below are just a few examples that I tend to use it for:

  • check the univariate distribution of a variable:
testdistr(mtcars$mpg, "normal")
  • check the univariate distribution of a variable with outlier and using robust mean and variance:
testdistr(c(mtcars$mpg, 60), "normal", extremevalues = "theoretical",
  robust = TRUE)
  • Winsorize to remove outlier:
testdistr(winsorizor(c(mtcars$mpg, 60), .01),
  "normal", extremevalues = "theoretical",
  robust = TRUE)
  • check the distributions of a variables' residuals
testdistr(resid(lm(Petal.Length ~ Species, data = iris)), "normal")
  • check for multivariate normality
testdistr(iris[,-5], "mvnormal")
  • view a heatmap of a correlation matrix
plot(SEMSummary(~ Petal.Length + Sepal.Length + Petal.Width + Sepal.Width, data = iris))

This package also has some utility functions used for other packages, such as calculating empirical p-values from bootstrapping or MCMC samples as from a Bayesian analysis, etc. These are probably less interesting to most users.

Copy Link

Version

Install

install.packages('JWileymisc')

Monthly Downloads

1,344

Version

0.3.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Joshua F Wiley

Last Published

September 15th, 2018

Functions in JWileymisc (0.3.1)

SEMSummary.fit

Summary Statistics for a SEM Analysis
formatHtest

Function to format the reuslts of a hypothesis test as text
as.na

Coerces vectors to missing
findSigRegions

Function to find significant regions from an interaction
detailedTests

Detailed Comparisons and Tests on Models
f.r2

Calculate F and p-value from the R2
cd

Change directory
moments

Estimate the first and second moments
mvqq

NOTE: this function is replaced and combined into the testdistr function.
corplot

Heatmap of a Correlation Matrix
VAConverter

Visual Acuity Converter
TukeyHSDgg

Tukey HSD Plot
formatLMER

Format results from a linear mixed model
APAStyler.mira

A generic function for pretty printing in (semi) APA Style
cor2cov

Convert a correlation matrix and standard deviations to a covariance matrix
.detailedTestsLMER

estimate detailed results per variable and effect sizes for both fixed and random effects from lmer models
corOK

Return a non-missing correlation matrix
.detailedTestsVGLM

Calculates all pairwise contrasts and omnibus tests for multinomial regression
lagk

Create a lagged variable
aces_daily

Multilevel Daily Data Example
gglikert

Creates a plot for likert scale
iccMixed

Intraclass Correlation Coefficient (ICC) from Mixed Models
compareIVs

Compares the effects of various independent variables on dependent variables
internalrunIt

Internal function to run a model using gam()
compareLMER

Compare two lmer models
internalformulaIt

Internal function to create a formula
timeshift

Shift a time variable to have a new center (zero point)
logicals

Several logical range comparison helpers
intSigRegGraph

Function to find significant regions from an interaction
updateInstall

Update R and install my core package set
plot.SEMSummary.list

Plots SEMSummary.list object
meanDecompose

Mean decomposition of a variable by group(s)
plotDiagnosticsLM

Plot Diagnostics for an lm model
meanDeviations

Function to calculate the mean and deviations from mean
acfByID

Estimate the effective sample size from longitudinal data
egltable

Function makes nice tables
empirical_pvalue

Calculates an empirical p-value based on the data
internalcompareIV

Compares the effects of various independent variables
vainternal

Internal Visual Acuity Functions
star

Function to simplify converting p-values to asterisks
formatMedIQR

Function to format the median and IQR of a variable
testdistr

Graphically compare the distribution of a variable against a specific distribution
formatPval

Function to simplify formatting p-values for easy viewing / publication
param_summary_format

Format a data frame of summary statistics
nEffective

Estimate the effective sample size from longitudinal data
plot.SEMSummary

Plots SEMSummary object
param_summary

Calculates summaries for a parameter
winsorizor

Winsorize at specified percentiles
roundedfivenum

Calculate a rounded five number summary
plotDiagnosticsLMER

Plot Diagnostics for an lmer model
scoring

Score a set of items to create overall scale score - generic
.plotDiagnosticsResiduals

Plot Residual Diagnostics
APAStyler.lm

A generic function for pretty printing in (semi) APA Style
R2LMER

Calculates the R2 from lmer models
CheckVals

Score a set of items to create overall scale score
SEMSummary

Summary Statistics for a SEM Analysis
APAStyler

A generic function for pretty printing in (semi) APA Style
VAObject-class

An S4 class to hold visual acuity data
VASummaryObject-class

An S4 class to hold visual acuity summary data
APAStyler.SEMSummary

A generic function for pretty printing in (semi) APA Style