knitr::opts_chunk$set(echo = TRUE)

Build Status CRAN_Status_Badge

Overview

statr is a personal R package that I have created for organizational/convenience purposes. This project is purely experimental! A (possibly incomplete) list of functions contained in the package can be found below:

See vignette or manual.

Installation

The easiest way to install is from the development version from Github:

# install.packages("devtools")
devtools::install_github("MGallow/statr")

If there are any issues/bugs, please let me know: github. You can also contact me via my website. Contributions are welcome!

Usage

library(statr)
library(magrittr)

# we will use the iris data set
X = dplyr::select(iris, -c(Species, Sepal.Length)) %>% as.matrix
y = dplyr::select(iris, Sepal.Length) %>% as.matrix
y_class = ifelse(dplyr::select(iris, Species) == "setosa", 1, 0)

# let us split the data for testing and training
CV = CVsplit(X, y)

# we can do some exploratory analysis
# plot Sepal.Length v Sepal.Width
iris %>% scatter(Sepal.Length, Sepal.Width)

# plot diagnostic plots
iris %>% diagnostic(Sepal.Length, Sepal.Width)

# use the training data to fit ridge regression
RIDGE(CV$X.train, CV$Y.train)

# or lasso regression
statr::LASSO(CV$X.train, CV$Y.train)

# we can also generate our own data
data = data_gen(p = 10, r = 5, n = 100)
CV = CVsplit(data$X, data$Y)

# and again fit a ridge regression
statr::RIDGE(CV$X.train, CV$Y.train)

# we can also generate random matrices with may be useful
# for other applications
# tridiagonal matrices
tridiag(p = 5)$Omega %>% round(5)

# dense matrices
dense(p = 5)$Omega %>% round(5)

# compound symmetric matrices
compound(p = 5)$Omega %>% round(5)


MGallow/statr documentation built on May 7, 2019, 2:04 p.m.