doc/getting_started_rvcetools.R

## ---- include = FALSE----------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup, eval=TRUE----------------------------------------------------
library(rvcetools)

## ------------------------------------------------------------------------
(s_input <- system.file("extdata","VCE_results.csv", package = "rvcetools"))

## ----read_vce, message=FALSE---------------------------------------------
(tbl_vce <- read_vce(psInputFile = s_input))

## ------------------------------------------------------------------------
(mat_vcov <- matrix(c(104,75,18,75,56,12,18,12,7), nrow = 3, byrow = TRUE))

## ------------------------------------------------------------------------
cov2cor(mat_vcov)

## ------------------------------------------------------------------------
(mat_cor <- cov_to_cor(mat_vcov))

## ------------------------------------------------------------------------
cor_to_cov(pmat_cor = mat_cor, pvec_var = diag(mat_vcov))

## ------------------------------------------------------------------------
(mat_npd <- matrix(data = c(100, 80, 20, 6, 80, 50, 10, 2, 20, 10, 6, 1, 6, 2, 1, 1), nrow = 4))

## ------------------------------------------------------------------------
eigen(mat_npd, only.values = TRUE)$values

## ------------------------------------------------------------------------
(mat_bent1 <- makePD2(A = mat_npd))

## ------------------------------------------------------------------------
eigen(mat_bent1, only.values = TRUE)$values

## ------------------------------------------------------------------------
(mat_bent2 <- make_pd_rat_ev(A = mat_npd, pn_max_ratio = 100))

## ------------------------------------------------------------------------
eigen(mat_bent2, only.values = TRUE)$values

## ------------------------------------------------------------------------
Matrix::nearPD(mat_npd)

## ------------------------------------------------------------------------
sessioninfo::session_info()
pvrqualitasag/rvcetools documentation built on Dec. 31, 2021, 2:09 p.m.