scpme

Shrinking characteristics of precision matrix estimators

https://github.com/mgallow/scpme

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.7%) to scientific vocabulary

Keywords

admm covariance-matrix glasso precision-matrix
Last synced: 9 months ago · JSON representation

Repository

Shrinking characteristics of precision matrix estimators

Basic Info
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
admm covariance-matrix glasso precision-matrix
Created almost 8 years ago · Last pushed almost 8 years ago
Metadata Files
Readme

README.Rmd

---
title: "SCPME"
output: github_document
  
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, tidy = TRUE)
```

[![Build Status](https://travis-ci.org/MGallow/shrink.svg?branch=master)](https://travis-ci.org/MGallow/SCPME)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/SCPME)](https://cran.r-project.org/package=SCPME)

## Overview

`SCPME` is an implementation of the methods described in "Shrinking Characteristics of Precision Matrix Estimators" ([link](https://doi.org/10.1093/biomet/asy023)). It estimates a penalized precision matrix via a modified alternating direction method of multipliers (ADMM) algorithm.

A (possibly incomplete) list of functions contained in the package can be found below: * `shrink()` computes the estimated precision matrix * `data_gen()` data generation function (for convenience) * `plot.shrink()` produces a heat map or line graph for cross validation errors See package [website](https://mgallow.github.io/SCPME/) or [manual](https://github.com/MGallow/ADMMsigma/blob/master/SCPME.pdf). ## Installation ```{r, eval = FALSE} # The easiest way to install is from GitHub: # install.packages("devtools") devtools::install_github("MGallow/shrink") ``` If there are any issues/bugs, please let me know: [github](https://github.com/MGallow/SCPME/issues). You can also contact me via my [website](https://mgallow.github.io/). Pull requests are welcome! ## Usage ```{r, message = FALSE} library(SCPME) set.seed(123) # generate data from a sparse oracle precision matrix # we can use the built-in `data_gen` function # generate 100 x 5 X data matrix and 100 x 1 Y data matrix data = data_gen(p = 5, n = 100, r = 1) # the default regression coefficients are sparse data$betas # default oracle precision matrix is also sparse round(qr.solve(data$SigmaX), 5) # now suppose we are interested in estimating the precision # print marginal sample precision matrix for X # this is perhaps a bad estimate (not sparse) sample = (nrow(data$X) - 1)/nrow(data$X)*cov(data$X) round(qr.solve(sample), 5) # now use SCPME to estimate preicison matrix (omega) assuming sparsity # note that this is simply a lasso penalized preicision matrix shrink(data$X, lam = 0.5, crit.cv = "loglik") # what if we instead assumed sparsity in beta? (print estimated omega) # recall that beta is a product of marginal precision of X and cov(X, Y) lam_max = max(abs(t(data$X) %*% data$Y)) (shrink = shrink(data$X, data$Y, B = cov(data$X, data$Y), nlam = 20, lam.max = lam_max)) # print estimated beta shrink$Z # we could also assume sparsity in beta AND omega (print estimated omega) (shrink2 = shrink(data$X, data$Y, B = cbind(cov(data$X, data$Y), diag(ncol(data$X))), nlam = 20, lam.max = 10, lam.min.ratio = 1e-4)) # print estimated beta shrink2$Z[,1, drop = FALSE] # produce CV heat map for shrink plot(shrink, type = "heatmap") # produce line graph for CV errors for shrink plot(shrink, type = "line") ```

Owner

  • Name: Matt Galloway
  • Login: MGallow
  • Kind: user
  • Location: Twin Cities, MN
  • Company: C.H. Robinson

Data scientist @ C.H. Robinson. Previously University of Minnesota PhD.

GitHub Events

Total
Last Year

Committers

Last synced: about 3 years ago

All Time
  • Total Commits: 165
  • Total Committers: 2
  • Avg Commits per committer: 82.5
  • Development Distribution Score (DDS): 0.024
Top Committers
Name Email Commits
MGallow g****1@u****u 161
Matt Galloway M****w@u****m 4
Committer Domains (Top 20 + Academic)
umn.edu: 1

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
cran.r-project.org: SCPME

Shrinking Characteristics of Precision Matrix Estimators

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 0
Rankings
Forks count: 21.9%
Dependent packages count: 29.8%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Average: 42.4%
Downloads: 89.7%
Last synced: over 2 years ago

Dependencies

DESCRIPTION cran
  • Rcpp >= 0.12.10 depends
  • RcppProgress >= 0.1 depends
  • doParallel * depends
  • dplyr * imports
  • foreach * imports
  • ggplot2 * imports
  • parallel * imports
  • stats * imports
  • glasso * suggests
  • knitr * suggests
  • microbenchmark * suggests
  • pkgdown * suggests
  • rmarkdown * suggests
  • testthat * suggests