plsr - Partial Least Squares Made Easy

Jan N. Schneider

2019-02-15

plsr (read: “pleasure”) is a package that provides simple to use Partial Least Squares Analysis.

It features:

Quick Start

The central function of the package is pls(). Given two matrices X and Y with arbitrary number of variables in columns and equal number of observations in rows this function will compute the latent variables that will maximize the covariance between X and Y. For example, a plsr object can be calculated like so:

library(plsr)
#> Be aware that plsr 0.0.1 contains experimental and partly untested code.
#> Use cautiously.
#> 
#> Attaching package: 'plsr'
#> The following object is masked from 'package:stats':
#> 
#>     loadings
plsr_obj=pls(X=rating_data,Y=tracking_data,n_perm=1000,n_boot=10)
#> Warning in pls(X = rating_data, Y = tracking_data, n_perm = 1000, n_boot
#> = 10): Bootstrapping functionality is still untested! No guarantee for
#> correctness! Use with extra care.

Inspecting Results

Resulting latent variables and their significances can be investigated using the generic functions summary() and plot():

summary(plsr_obj)
#> Permutation iterations: 1000 
#> P_values:
#> [1] 0.000999001 0.000999001 0.128871129 0.885114885 0.915084915 1.000000000
#> [7] 1.000000000
#> 
#> Bootstrap iterations: 10 
#> 
#> Loading matrix for Y-side (U) too big...ommited
#> 
#> Loading matrix for X-side (V)
#> 
#>                    LV1         LV2        LV3          LV4         LV5
#> happy      -0.51866888 -0.03047300  0.2820295 -0.161209033  0.29692132
#> sad         0.31765080  0.04152656 -0.3206474  0.018493299  0.46567703
#> surprised  -0.03495412 -0.87088133 -0.1728669  0.009944748 -0.38290106
#> disgusted   0.40324432 -0.13441072  0.3101666 -0.845374509  0.06503936
#> angry       0.57686587 -0.19163284  0.5036483  0.497881859  0.17475943
#> fearful     0.15606667 -0.16427285 -0.6195140 -0.077697923  0.39910665
#> interested -0.33033581 -0.39640597  0.2325922  0.070635499  0.59524140
#>                    LV6         LV7
#> happy      -0.22257774  0.69772622
#> sad        -0.75681492 -0.06777050
#> surprised  -0.23323541  0.09669586
#> disgusted   0.05318521 -0.03751827
#> angry       0.11166760  0.29316232
#> fearful     0.53208933  0.34120064
#> interested  0.15771555 -0.54356743
plot(plsr_obj)