orsf_scale_cph {aorsf} | R Documentation |

## Scale input data

### Description

These functions are exported so that users may access internal routines that are used to scale inputs when orsf_control_cph is used.

### Usage

```
orsf_scale_cph(x_mat, w_vec = NULL)
orsf_unscale_cph(x_mat)
```

### Arguments

`x_mat` |
( |

`w_vec` |
( |

### Details

The data are transformed by first subtracting the mean and then
multiplying by the scale. An inverse transform can be completed using
`orsf_unscale_cph`

or by dividing each column by the corresponding scale
and then adding the mean.

The values of means and scales are stored in an attribute of the output
returned by `orsf_scale_cph`

(see examples)

### Value

the scaled or unscaled `x_mat`

.

### Examples

```
x_mat <- as.matrix(pbc_orsf[, c('bili', 'age', 'protime')])
head(x_mat)
x_scaled <- orsf_scale_cph(x_mat)
head(x_scaled)
attributes(x_scaled) # note the transforms attribute
x_unscaled <- orsf_unscale_cph(x_scaled)
head(x_unscaled)
# numeric difference in x_mat and x_unscaled should be practically 0
max(abs(x_mat - x_unscaled))
```

*aorsf*version 0.1.5 Index]