transformation: Transform dimensions using an RSDR model

Description Usage Arguments Value Examples

View source: R/transformation-function.R

Description

This function transforms input dimensions using a re-sampled dimensional reduction model fitted by rsdr().

Usage

1
2
3
4
5
6
7
8
9
transformation(
  tidy_set,
  rsdr_object,
  dimensions = NULL,
  input_dim = NULL,
  top_n = NULL,
  output_dim = NULL,
  verbose = T
)

Arguments

tidy_set

A TidySet (i.e. ExpressionSet) containing the visits of subjects in outcome dataset, paid by any payment systems. This TidySet also accomodates outcome dataset. This is an output of compile_mh_outcome() from medhist package, or manually compiled using ExpressionSet() from Biobase package.

rsdr_object

RSDR object, a list of results and parameters. This is an output from rsdr() function.

dimensions

Dimension index, a vector of integers for the column indices of the table, indicating the output dimensions transformed by rsdr(). The maximum integer is the minimum number of output dimensions among many dimensional reduction models from differen resampled subsets.

input_dim

Input dimension, a vector of characters containing the names of input dimensions that are selected to transform into output dimensions.

output_dim

Output dimension, a vector of characters containing the names of output dimensions that are selected after transformation.

verbose

Verbosity, a logical indicating whether progress should be shown.

Value

A TidySet (i.e. ExpressionSet) containing the transformed table accessed using exprs() function from Biobase package. Composition of input dimensions as a weight table can be accessed using fData() from the same package. RSDR models and proportion of variance explained (PVE) using input_dim and output_dim can be accessed using preproc().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
## Create input example
library(medhist)
data(medhistdata)
ps_remover=extract_nps_mh(medhistdata)

mh_bin_nps=
  medhistdata[ps_remover_train$key,] %>%
  `exprs<-`(
    exprs(.) %>%
      t() %>%
      as.data.frame() %>%
      rownames_to_column(var='id') %>%
      column_to_rownames(var='id') %>%
      t()
  ) %>%
  trans_binary(verbose=F)
 
input=
  mh_bin_nps %>%
  exprs() %>%
  t() %>%
  as.data.frame()
 
## Fit dimensional reduction models with resampling
rsdr_bin_nps=rsdr(input,'CV',10,'PCA')

## Transform dimensions using an RSDR model
dr_bin_nps=
  mh_bin_nps %>%
  transformation(
    rsdr_object=rsdr_bin_nps
    ,input_dim=rownames(mh_bin_nps)
    ,top_n=6
    ,verbose=F
  )

herdiantrisufriyana/rsdr documentation built on Feb. 15, 2021, 7:55 p.m.