We show a simple example in which we fit PheNorm to a simulated dataset.

Load the simulated data

fit.dat <- read.csv("https://raw.githubusercontent.com/celehs/PheNorm/master/data-raw/data.csv")
str(fit.dat)
#> 'data.frame':    500 obs. of  4 variables:
#>  $ X1 : num  -1.38 0.995 0.524 1.48 1.344 ...
#>  $ X2 : num  -1.73 -0.624 1.757 -0.563 0.296 ...
#>  $ ICD: num  0.693 1.386 1.386 1.386 1.792 ...
#>  $ utl: num  3.78 3.91 3.83 3.87 3.64 ...

Apply the PheNorm algorithm

set.seed(1234)
fit.phenorm <- PheNorm.Prob(
  nm.logS.ori = "ICD", 
  nm.utl = "utl", 
  dat = fit.dat, 
  nm.X = NULL, 
  corrupt.rate = 0.3, 
  train.size = nrow(fit.dat)
)
str(fit.phenorm)
#> List of 2
#>  $ probs: num [1:500] 0.466 0.538 0.546 0.542 0.609 ...
#>  $ betas: NULL