Comments (7)
Certainly, everything should work fine without monitoring variable. Just never use any propensity scores for monitoring and don't define the monitoring variable name when loading the data (i.e., leave it as the default)
from stremr.
I believe I have done as you describe -- can you help identify what is wrong with my minimal working example below? It breaks at the defineIntervedTRT() step.
require(stremr)
require(data.table)
# EXAMPLE WITH CENSORING
data(OdataCatCENS)
test_dat <- as.data.table(OdataCatCENS, key=c(ID, t))
test_dat <- test_dat[ , !c( "CatC" , "N" , "lastNat1") ]
# Regressions for modeling the exposure (TRT)
gform_TRT <- "TI ~ CVD + highA1c"
# Regressions for modeling censoring (CENS)
gform_CENS <- c("C ~ highA1c")
# Define dynamic rule: dhigh
test_dat <- defineIntervedTRT(test_dat, theta = c(1), ID = "ID", t = "t",
I = "highA1c", CENS = "C", TRT = "TI", new.TRT.names = c( "dhigh" ),
return.allcolumns = TRUE)
# Estimate IPW-based hazard and survival (KM) for a rule "dhigh":
IPW_KM_res <- stremr(test_dat , intervened_TRT = "dhigh",
ID = "ID", t = "t", covars = c("highA1c"),
CENS = "C", gform_CENS = gform_CENS,
TRT = "TI", gform_TRT = gform_TRT, OUTCOME = "Y.tplus1")
# Survival estimates by time:
IPW_KM_res$IPW_estimates
# Input data:
IPW_KM_res$dataDT
Edit: Changed a reference to MONITOR and lastNat1 in the stremr call. This is downstream of the defineIntervedTRT call though, so does not alter where the code first breaks.
from stremr.
Sure, happy to help, would you mind copy pastying the entire log, including all errors?
Also, why are you testing the example with categorical censoring, any specific reason for that?
from stremr.
I want to use a dynamic treatment rule, and the example I found in stremr documentation with DTR has categorical censoring -- you'll notice, however, that I am not using CatC, I am using C for censoring which is binary.
Also, I have altered the code in my original post to include libraries and exclude a errant reference to MONITOR (that was downstream of the defineIntervedTRT call, so I do not think affected where the code is breaking).
R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> require(stremr)
R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
> require(stremr)
Loading required package: stremr
stremr
Version: 0.4
stremr IS IN EARLY DEVELOPMENT STAGE.
Please be to sure to check for frequent updates and report bugs at: http://github.com/osofr/stremr
To install the latest development version of stremr, please type this in your terminal:
devtools::install_github('osofr/stremr')
> require(data.table)
Loading required package: data.table
data.table 1.10.4.2
The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way
Documentation: ?data.table, example(data.table) and browseVignettes("data.table")
Release notes, videos and slides: http://r-datatable.com
Warning message:
package 'data.table' was built under R version 3.4.2
>
> # EXAMPLE WITH CENSORING
> data(OdataCatCENS)
> test_dat <- as.data.table(OdataCatCENS, key=c(ID, t))
> test_dat <- test_dat[ , !c( "CatC" , "N" , "lastNat1") ]
>
> # Regressions for modeling the exposure (TRT)
> gform_TRT <- "TI ~ CVD + highA1c"
>
> # Regressions for modeling censoring (CENS)
> gform_CENS <- c("C ~ highA1c")
>
> # Define dynamic rule: dhigh
> test_dat <- defineIntervedTRT(test_dat, theta = c(1), ID = "ID", t = "t",
+ I = "highA1c", CENS = "C", TRT = "TI", new.TRT.names = c( "dhigh" ),
+ return.allcolumns = TRUE)
Error in names(data) %in% varname :
argument "MONITOR" is missing, with no default
>
> # Estimate IPW-based hazard and survival (KM) for a rule "dhigh":
> IPW_KM_res <- stremr(test_dat , intervened_TRT = "dhigh",
+ ID = "ID", t = "t", covars = c("highA1c"),
+ CENS = "C", gform_CENS = gform_CENS,
+ TRT = "TI", gform_TRT = gform_TRT, OUTCOME = "Y.tplus1")
Error in CheckVarNameExists(OData$dat.sVar, Nnode) :
variable name N not found in data input
>
> # Survival estimates by time:
> IPW_KM_res$IPW_estimates
Error: object 'IPW_KM_res' not found
> # Input data:
> IPW_KM_res$dataDT
Error: object 'IPW_KM_res' not found
>
from stremr.
from stremr.
Thank you!
from stremr.
FYI noticed I had an older version of stremr -- the bug does not appear in the newer version. Thanks for your help, Oleg!
from stremr.
Related Issues (20)
- add option for isotonic regression on cumulative risks estimates over time
- Add option for observation weights HOT 2
- Return a warning when g^*=NA
- IPW for Categorical Exposure with 4 levels HOT 1
- Defining counterfactual dynamic treatment nodes with multiple dummy exposure HOT 4
- Better docs of the function output
- option : return_wts = TRUE dose not work for survNPMSM and only return results when used in directIPW HOT 5
- sequential randomization HOT 3
- stremr output HOT 1
- Fit treatment propensity based only on initial time point HOT 8
- stratifyQ_by_rule HOT 2
- package dependencies
- Problem with CVTMLE
- Time dependent propensity models HOT 3
- ID cannot be a factor, all character variables will be ignored
- inconsistency between doc and implementation for getIPWeights
- getIPWeights - need to add a check that user has specified PS model for all nodes on which we intervene
- bug in defineMONITORvars
- older version of stremr and new version of sl3 are not compatible
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stremr.