README

Build Status

A package to read, process and model a specific clinical dataset in order to investigate the PEDIS classification system used to asses the clinicial picture of the Diabetic Foot Ulcer.

Showcase

# data import
# library contain dataset pedis
library(PEDISdata)

# data preprocessing
# create output vector and matrix of predictors
X_y <- prepare_X_y(data = pedis, outcome = "minor_amputation", vars = c("p", "d", "i", "s"))
folds <- create_folds(y = X_y$y)

# Model training
fit <- train_pedis(X = X_y$X, y = X_y$y, folds = folds)

# Prediction
# prediction for the first fold in the list
train_predicted <- train_predict(folds = folds, X_y = X_y)
train_auc(folds = folds, X_y = X_y)
train_roc <- roc(train_predicted)

# Test Set
test_predicted <- test_predict(fit)
test_auc(fit)
test_roc <- roc(test_predicted)
plot(test_roc)
# plot
pROC::smooth(test_roc)
pROC::smooth(train_roc)
plot_train_test(train_roc, test_roc)
library(PEDISdata)
library(magrittr)
library(dplyr)

# Read the data
pedis <- read_all_pedis(path = "~/r-projects/proj_wunde/pedis-diabetic-care/datasets")
pedis <- pedis %>% mutate(pedis_wert = p + e + d + i + s)

# Create list with X and y
X_y <- prepare_X_y(data = pedis, outcome = "amputation", vars = c("p"))
# Create folds
folds <- create_folds(y = X_y$y)
# Fit the model (with caret in the backyard)
fit <- PEDISdata::train_pedis(X = X_y$X, y = X_y$y, folds = folds)

# In sample error
train_predicted <- train_predict(folds = folds, X_y = X_y)
train_auc(folds = folds, X_y = X_y) %>% pull("auc") %>% mean
train_roc <- roc(train_predicted)

# Out of sample error (test error)
test_predicted <- test_predict(fit)
test_auc(fit = fit) %>% mean
test_roc <- roc(test_predicted)

# Compare AUC Curves
plot_train_test(trainROC = train_roc, testROC = test_roc)
library(PEDISdata)
pedis <- read_all_pedis(path = "~/r-projects/proj_wunde/pedis-diabetic-care/datasets")

pedis_ordinal <- pedis %>% mutate_at(c("p", "e_ordinal_5", "d", "i", "s"), factor, levels = 1:4) %>% 
  select(p, e = e_ordinal_5, d, i, s, amputation)

X_y <- prepare_X_y(data = pedis_ordinal, outcome = "amputation", vars = c("p", "e", "d", "i", "s"))
create_folds(y = X_y$y)
train_pedis(X = X_y$X, y = X_y$y, folds = folds)

data <- cbind(as.data.frame(X_y$X), y = if_else(X_y$y == "yes", 1, 0))
glm(y ~ ., data = data, family = binomial(link = "logit"))
# Eine ähnliche Gewichtung wie Pickwell machen.

# Dann eine gewichtete Regression durchführe
# Dann noch CRP Werte einfließen lassen

# Argument: Abfrage wird genauer, aber auch komplexer, direkte einbindung in die DOkuementation als Rückkopplung.
# Zusätzlich die Kreuzvalierung diskutieren.


jnshsrs/PEDISdata documentation built on June 24, 2019, 12:07 p.m.