Skip to content

Commit

Permalink
fixing bug in eval.param for MSM (bug identified due to data.table sy…
Browse files Browse the repository at this point in the history
…ntax change)
  • Loading branch information
osofr committed Dec 11, 2016
1 parent 6c0d651 commit a4c0ddf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: simcausal
Type: Package
Version: 0.5.2.00
Version: 0.5.3.00
Title: Simulating Longitudinal Data with Causal Inference Applications
Authors@R: c(
person("Oleg", "Sofrygin", role=c("aut", "cre"), email="oleg.sofrygin@gmail.com"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,9 @@ simcausal 0.5.1
* Switching to new naming convention for categorical distributions (rcat.b0, rcat.b1 and rcat.factor). Old rcategor.int and rcategor are still available and are deprecated.


simcausal 0.5.3
==============

* Fixing a bug in that was identified due to changes to data.table (eval.MSM() was incorrectly checking for NA outcomes)
* Fixing a CRAN error in test on R devel.

6 changes: 4 additions & 2 deletions R/targetparam.r
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,10 @@ eval.MSM <- function(DAG, df_full, outnodes, outnode_nms, params.MSM, attrs, ver
}
}

naout_byaction <- sapply(df_full, function(df) any(is.na(df[,outcome]))) # CHECK THAT NO OUTCOME NODES ARE MISSING (NA)
if (any(naout_byaction)) stop("Unable to evaluate MSMs outcome "%+%outcome%+% ", for action(s) ", paste(names(df_full)[naout_byaction], collapse=","), ", some observations are censored before the outcome, check DAG(s) defining the action(s)")
naout_byaction <- sapply(df_full, function(df) any(is.na(df[[outcome]]))) # CHECK THAT NO OUTCOME NODES ARE MISSING (NA)
if (any(naout_byaction)) stop("Unable to evaluate MSMs outcome "%+%outcome%+% ", for action(s) ",
paste(names(df_full)[naout_byaction], collapse=","),
", some observations are censored before the outcome, check DAG(s) defining the action(s)")

# * Combine all actions into one dataframe and convert to long format
df_combine <- data.table::rbindlist(df_full, fill=TRUE)
Expand Down

0 comments on commit a4c0ddf

Please sign in to comment.