jaredhuling / personalized Goto Github PK
View Code? Open in Web Editor NEWMethods for subgroup identification / personalized medicine / individualized treatment rules
Home Page: http://jaredhuling.org/personalized/
Methods for subgroup identification / personalized medicine / individualized treatment rules
Home Page: http://jaredhuling.org/personalized/
This looks good. Instead of the long examples (ex. the fit.subgroup function), write a vignette with a little more explanation.
Warning message:
The dot-dot notation (..density..
) was deprecated in ggplot2 3.4.0.
ℹ Please use after_stat(density)
instead.
ℹ The deprecated feature was likely used in the personalized package.
Please report the issue at
https://github.com/jaredhuling/personalized/issues.
Dear authors,
Thank you very much for your excellent package; and I have a problem in working with survival outcome data with counting process format.
library(personalized)
library(survival)
> dtRNA %>% select(PtID,startTime,endTime,status) %>% head(10)
# A tibble: 10 × 4
PtID startTime endTime status
<chr> <dbl> <dbl> <dbl>
1 AH01 0 2 0
2 AH01 2 4 0
3 AH01 4 8 0
4 AH02 0 2 0
5 AH02 2 4 0
6 AH02 4 13 0
7 AH03 0 2 0
8 AH03 2 4 0
9 AH03 4 10 0
10 AH04 0 2 0
#Data reformat
trt <- if_else(dtRNA$UTI_flg=="UTI",1,0)
trt <- if_else(dtRNA$fluidvaso_tag=="restrictive",1,0)
Xmatrix <- assay(vsd) %>%
as.data.frame() %>%
select(dtRNA$SampleName) %>%
t()
start.time = dtRNA$startTime
end.time = dtRNA$endTime
end.time = if_else(is.na(end.time),start.time+2,end.time)
status <- dtRNA$status
# create function for fitting propensity score model
prop.func <- function(x, trt)
{
# fit propensity score model
propens.model <- cv.glmnet(
y = trt,
x = x,
family = "binomial")
pi.x <- predict(propens.model, s = "lambda.min",
newx = x, type = "response")[,1]
pi.x
}
plot_overlap <- check.overlap(
Xmatrix, trt, prop.func,
type = "both")
#Fitting Subgroup Identification Models
subgrp.model <- fit.subgroup(
x = Xmatrix,
y = Surv(start.time,end.time, status),
trt = trt,
method = "weighting",
propensity.func = prop.func,
loss = "cox_loss_lasso",cutpoint = "median",
nfolds = 5) # option for cv.glmnet
summary(subgrp.model)
The PtID indicate a unique patient subject; and each patient can have multiple observations. I feel that this model is not correctly fit because there is no argument in the fit.subgroup
function to indicate patient ID. The outcome is given in y = Surv(start.time,end.time, status)
. Are there any hints for survival model with counting process data?
Allow for parallelization of bootstrap and training-test resampling procedures.
add hinge loss option (binary and continuous outcomes) via kernlab. this may be involved as we will need to carefully specify the kernel such that observation weights can be incorporated
add OWL type loss for both binary and multi trt options
It might be useful to include the data you simulate in the vignette as a dataset in your package. Then people can simply load it to use the vignette.
the check overlap function now only works for treatment/control setting. It will be more complicated for multiple treatments. need to make checks that the propensity function returns a matrix, not a vector in this case
With the multiple treatments update in place, is the default behavior of propensity.func()
within fit.subgroup()
correct for its return of pi.x
?
For instance, when n.trts == 2
, all subjects get assigned the same value of mean.trt
. However, when there are more, say n.trts == 3
, then there are 3 different possible values assigned (each getting the mean of their respective category of membership).
This seems like a disconnect (going from 1 to 2 treatments but going from 1 to 3 unique values of pi.x
).
Doesn't the generalized version already provide the right calculation when n.trts == 2?
. Could the following block be removed from propensity.func()
without breaking anything?
if (n.trts == 2)
{
mean.trt <- mean(trt == unique.trts[2L])
propensity.func <- function(trt, x) rep(mean.trt, length(trt))
} else
For reference, the entire block of code I'm referring to is this:
if (is.null(propensity.func))
{
if (n.trts == 2)
{
mean.trt <- mean(trt == unique.trts[2L])
propensity.func <- function(trt, x) rep(mean.trt, length(trt))
} else
{
mean.trt <- numeric(n.trts)
for (t in 1:n.trts)
{
mean.trt[t] <- mean(trt == unique.trts[t])
}
propensity.func <- function(trt, x)
{
pi.x <- numeric(length(trt))
for (t in 1:n.trts)
{
which.t <- trt == unique.trts[t]
pi.x[which.t] <- mean(which.t)
}
pi.x
}
}
}
propensity score function should return a matrix where each column represents the probability of a particular treatment. Should it be K-1 or K columns? K may be easier, but need to make sure enforcement of ordering with respect to the treatments is clear to the user
this causes errors for losses which are formula-based (eg gam)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.