Closed alexadima closed 4 years ago
for displaying CMA estimates using sliding window and treatment episode functions, there is the option of plot CMA, and as staked bars, as overlapping bars, as time series. when plot CMA is ON, the histogram of CMA values is shown on the left side, and the other 3 become optional. There is no possibility to take out the left side plot and leave one of the 3 optional on top.
DATA <- med.events;
get.data.for.patients.fnc <- function(patientid, d, idcol, cols=NA, maxrows=NA) d[ d[[idcol]] %in% patientid, ]
DATApat1 <- get.data.for.patients.fnc( c("1"), DATA, ### don't forget to put here your REAL DATA! ### "PATIENT_ID" );
cma <- CMA_sliding_window(data=DATApat1, CMA="CMA7",
# not relevant for a particular CMA type, we
# nevertheless pass them as they will be ignored)
ID.colname="PATIENT_ID",
event.date.colname="DATE",
event.duration.colname="DURATION",
event.daily.dose.colname="PERDAY",
medication.class.colname="CATEGORY",
carry.only.for.same.medication=FALSE,
consider.dosage.change=FALSE,
followup.window.start=0,
followup.window.start.unit="days",
followup.window.duration=730,
followup.window.duration.unit="days",
observation.window.start=0,
observation.window.start.unit="days",
observation.window.duration=730,
observation.window.duration.unit="days",
sliding.window.start=0,
sliding.window.start.unit="days",
sliding.window.duration=90,
sliding.window.duration.unit="days",
sliding.window.step.duration=60,
sliding.window.step.unit="days",
sliding.window.no.steps=10,
date.format="%m/%d/%Y"
);
if( !is.null(cma) ) # if the CMA was computed ok {
plot(cma,
# they aren't used in a particular case)
align.all.patients=FALSE,
align.first.event.at.zero=FALSE,
show.legend=TRUE,
legend.x="right",
legend.y="bottom",
legend.bkg.opacity=0.5,
legend.cex=0.75,
legend.cex.title=1,
duration=NA,
show.period="days",
period.in.days=90,
bw.plot=FALSE,
col.na="#D3D3D3",
unspecified.category.label="drug",
col.cats=rainbow,
lty.event="solid",
lwd.event=2,
pch.start.event=15,
pch.end.event=16,
col.continuation="#000000",
lty.continuation="dotted",
lwd.continuation=1,
cex=1,
cex.axis=0.75,
cex.lab=1,
highlight.followup.window=TRUE,
followup.window.col="#00FF00",
highlight.observation.window=TRUE,
observation.window.col="#FFFF00",
observation.window.opacity=0.3,
show.real.obs.window.start=TRUE,
print.CMA=TRUE,
CMA.cex=0.5,
plot.CMA=TRUE,
CMA.plot.ratio=0.1,
CMA.plot.col="#90EE90",
CMA.plot.border="#006400",
CMA.plot.bkg="#7FFFD4",
CMA.plot.text="#006400",
plot.CMA.as.histogram=FALSE,
show.event.intervals=TRUE,
print.dose=FALSE,
cex.dose=0.01,
print.dose.outline.col="#FFFFFF",
print.dose.centered=FALSE,
plot.dose=FALSE,
lwd.event.max.dose=8,
plot.dose.lwd.across.medication.classes=FALSE,
min.plot.size.in.characters.horiz=0,
min.plot.size.in.characters.vert=0
); }
Fixed in the devel
branch: now the summary of the CMAs on the left and the partial CMAs on top are independent; also the help entries should be clearer. Likewise, the Shiny interface controls them now independently.
bold blah