knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This vignette goes over typical 'construction' projects for each of the analysis designs. First, let's load up mason!
library(mason)
swiss %>% design('t.test') %>% add_settings() %>% add_variables('yvars', c('Fertility', 'Agriculture')) %>% add_variables('xvars', c('Examination', 'Education')) %>% construct() %>% scrub()
swiss %>% design('cor') %>% add_settings() %>% add_variables('yvars', c('Fertility', 'Agriculture')) %>% add_variables('xvars', c('Examination', 'Education')) %>% construct() %>% scrub()
swiss %>% design('glm') %>% add_settings() %>% add_variables('yvars', c('Fertility', 'Agriculture')) %>% add_variables('xvars', c('Examination', 'Education')) %>% add_variables('covariates', 'Catholic') %>% construct() %>% scrub()
data.frame(state.x77, state.region) %>% design('gee') %>% add_settings(cluster.id = 'state.region') %>% add_variables('yvars', c('Income', 'Frost')) %>% add_variables('xvars', c('Population', 'Murder')) %>% add_variables('covariates', c('Life.Exp', 'Area')) %>% add_variables('interaction', 'Area') %>% construct() %>% add_variables('xvars', c('Illiteracy')) %>% construct() %>% scrub()
PLS is implemented through several different algorithm, which are often fairly
similar in their results. The default for mason is the default [pls::plsr()
]
kernel algorithm. Eventually mason will allow using other algorithms (like
SIMPLS)... but baby steps. The kernel algorithm is good for "tall matrices",
i.e. many observations and few variables (the type of data I often use).
Resources include this CrossValidated post
and this website,
both of which provide a lot of detail on interpreting the results of PLS. And of
course there is the vignette from the pls package itself: vignette("pls-manual", package = "pls")
.
There are several outputs/results from PLS models:
For more detail of what outputs are "scrub
bed", see the [tidy_up()
] function
documentation. Below is an example usage:
pls_model <- swiss %>% design('pls') %>% add_settings(validation = 'CV', cv.data = TRUE) %>% add_variables('yvars', c('Agriculture')) %>% add_variables('xvars', c('Examination', 'Education', 'Fertility')) %>% construct() scrub(pls_model) scrub(pls_model, "default") scrub(pls_model, "scores") scrub(pls_model, "loadings")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.