MyNixOS website logo
Description

'HJ-Biplot' using Different Ways of Penalization Plotting with 'ggplot2'.

The 'HJ-Biplot' is a multivariate method that represents high-dimensional data in a low-dimensional subspace, capturing most of the information’s variability in just a few dimensions. This package implements three new regularized versions of the HJ-Biplot: Ridge, LASSO, and Elastic Net. These versions introduce restrictions that shrink or zero-out variable weights to improve interpretability based on regularization theory. All methods provide graphical representations using 'ggplot2'.

SparseBiplots

CRAN status

Overview

Sparse Biplots are modern variant of HJ-Biplot which attempts to find sparse loadings, i.e., weight vectors with only a few nonzero values. Introducing a penalty parameter helps improve the interpretation of the model because the axis are formed as a linear combination of only some of the original variables.

This package provides functions to perform the HJ-Biplot (Galindo, 1986) and modifications introducing Ridge, LASSO and Elastic Net penalty:

  • HJBiplot: performs the HJ-Biplot .
  • Ridge_HJBiplot: performs the HJ-Biplot introducing Ridge penalty.
  • LASSO_HJBiplot: performs the HJ-Biplot introducing LASSO penalty.
  • ElasticNet_HJBiplot: performs the HJ-Biplot introducing Elastic Net penalty. For this use the spca package.
  • Plot_Biplot: create the plot of the results obtained with any of the above functions. It generates elegant data visualization using ggplot2 with little code

Installation

  • Install SparseBiplots from CRAN:
install.packages("SparseBiplots")
  • Install SparseBiplots from GitHub using devtools:
install.packages("devtools")
devtools::install_github("mitzicubillamontilla/SparseBiplots")

Usage

Parameters

  • X: data frame which provides the data to be analyzed. All the variables must be numeric.
  • Transform.Data: character indicating whether the columns have to be scaled or centered. Allowed values are: "center" and "scale" (default).
  • lambda: tuning parameter for each penalty. In Elastic Net it refers to LASSO penalty.
  • àlpha: tuning parameter of the Ridge shrinkage (just allowed with Elastic Net penalty).
  • operator: operator used to solve the norm L1 (just allowed with LASSO penalty). Allowed values are: 'Hard-Thresholding' and 'Soft-Thresholding'.
  • ind_name: logical value which indicates if prints the name for each row of X (FALSE by default).
  • vec_name: logical value which indicates if prints the name for each column of X (TRUE by default).

Values

  • loadings: loadings matrix.
  • coord_ind: row coordinates matrix (individuals).
  • coord_var: column coordinates matrix (variables).
  • eigenvalues: approximated eigenvalues vector.
  • explvar: vector containing the proportion of variance explained by the k axis obtained.
  • n_ceros: matrix which indicates the number of loadings equal to cero in each axis (output exclusive just for LASSO and Elastic net penalties)

Plot_Biplot parameters

  • X: list containing the output of one of the functions of the package.
  • axis: vector with lenght 2 which contains the axis ploted in x and y axis.
  • hide: vector specifying the elements to be hidden on the plot. Default value is “none”. Other allowed values are “ind” and “var”.
  • labels: it indicates the label for points. If it is "auto" the labels are the row names of the coordinates of individuals. If it isn't auto it would be a vector containing the labels.
  • ind.shape: points shapes. It can be a number to indicate the shape of all the points or a factor to indicate different shapes.
  • ind.color: points colors. It can be a character indicating the color of all the points or a factor to use different colors.
  • ind.size: numeric value indicating the size of points.
  • ind.label: logical name indicating if prints the row names.
  • ind.label.size: numeric value indicating the size of the label of points.
  • var.col: character indicating the color of the arrows.
  • var.size: size of arrow.
  • var.arrow.type: one of "open" or "closed" indicating whether the arrow head should be a closed triangle.
  • var.arrow.angle: the angle of the arrow head in degrees (smaller numbers produce narrower, pointier arrows). Essentially describes the width of the arrow head.
  • var.arrow.length: length of the arrow head (in cm).
  • var.label: logical name indicating if prints the column names.
  • var.label.size: numeric value indicating the size of the labels of variables.
  • var.label.angle: logical value indicating if print the vector names with orentation of the angle of the vector.

Example

library("SparseBiplots")
hj.biplot <- HJBiplot(mtcars)

It fit the HJ-Biplot on the R data mtcars returning a list that contains the results of the fiting (hj_mtcars). To create the plot use the function Plot_Biplot over the list obtained.

Plot_Biplot(hj.biplot, ind.label = TRUE)

References

Metadata

Version

4.1.1

License

Unknown

Platforms (76)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows