Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/llrs/intermodel

Find models of interaction
https://github.com/llrs/intermodel

canonical-correlation-analysis r

Last synced: 1 day ago
JSON representation

Find models of interaction

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# inteRmodel

[![R build status](https://github.com/llrs/inteRmodel/workflows/R-CMD-check/badge.svg)](https://github.com/llrs/inteRmodel/actions)
[![Codecov test coverage](https://codecov.io/gh/llrs/inteRmodel/branch/master/graph/badge.svg)](https://codecov.io/gh/llrs/inteRmodel?branch=master)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![DOI](https://zenodo.org/badge/198424052.svg)](https://zenodo.org/badge/latestdoi/198424052)

The goal of inteRmodel is to help you with interaction models using [RGCCA](https://cran.r-project.org/package=RGCCA) to asses the stability of the model and the best model possible given the data provided.
The package assumes that the blocks are all connected.

You can apply bootstraping to the models with `search_model`,
then `iterate_model` or bootstrap the samples with `boot_samples_sgcca` and `boot_index_sgcca`.

For further information about the regularized canonical correlations and the interpretation read the
[RGCCA](https://cran.r-project.org/package=RGCCA) vignette and the associated articles.

If the CRAN version is too slow you could try [my fork](https://www.github.com/llrs/RGCCA) which has some more dependencies but is much faster.

## Installation

You can install the released version of inteRmodel from [Github](https://www.github.com/llrs/inteRmodel) with:

```{r install, eval=FALSE}
devtools::install_github("llrs/inteRmodel")
```

## Example

This is a basic example which shows you how to apply the bootstraping on this analysis:

```{r example, collapse=TRUE, results='hide'}
library(inteRmodel)
data("Russett", package = "RGCCA")
X_agric <- as.matrix(Russett[, c("gini", "farm", "rent")])
X_ind <- as.matrix(Russett[, c("gnpr", "labo")])
X_polit <- as.matrix(Russett[ , c("inst", "ecks", "death", "demostab",
"dictator")])
A <- list(X_agric, X_ind, X_polit)
set.seed(879138)
boots <- 10
C <- matrix(c(0, 0, 1, 0, 0, 1, 1, 1, 0), 3, 3)
boot_i <- boot_samples_sgcca(A = A, C = C, c1 = rep(1, 3), nb_boot = boots)
```
We can see the [AVE](https://en.wikipedia.org/wiki/Average_variance_extracted) of the bootstraps by using:

```{r print, collapse=TRUE}
head(boot_i$AVE)
```

The AVE scores is for each bootstrap sample, which help to decide which is the stability of the model.

See the vignette for a full example.