---
title: "Example on simulated dataset"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Example on simulated dataset}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

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

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r}
library(PheNorm)
```

Load the simulated data

```{r}
fit.dat <- read.csv("https://raw.githubusercontent.com/celehs/PheNorm/master/data-raw/data.csv")
str(fit.dat)
```

Apply the PheNorm algorithm

```{r}
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)
)
```

```{r}
str(fit.phenorm)
```