Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi
I'm trying to realizing a Kaplan Mayer Survival non parametric model in PowerBI Desktop using script R, with filter in a drill-down
I have a flat file/table in PowerBI with main information for drill down, this is my script
library(survival)
time=dataset$tenure
event=dataset$censor
kmsurvival=survfit(Surv(time, event)~1, conf.type="none")
plot(kmsurvival, xlab="tenure", ylab="Survival Probability", col.lab="red", pch="1", lwd="3", col="blue", bg="yellow", xscale=1, xlim=c(1,24))
where
tenure is numeric
censor is numeric (1=died, 0=live)
The probability result seems to be overstimated
Can anyone please help me how to solve this? is my script wrong?
thank you
Does any of you has any good advice on this important problem?
Hi @Silver75,
Your script is right as I tested. I run the sample script and get expected result.
I create a sample table.
Then click R visual highlighted in red line in the following screenshot. Select the Test[tenure] andTest[censor] as value levels.
Type the R script and run, you will get the desired result which is same with the picture in Rsudio.
If there is any error message when you run the scipt? Could you please share more details for further analysis.
Best Regards,
Angelia
thank you, any error during the script, the survival probability is overstimated respect other software, in particular KM cut some time intervals.
In add, If I insert in the dataset other variable (eg sex, civil status, etc..) the Drill – Down on survival graph doesn’t work
Hi @Silver75,
Do you mind share your .pbix file for further analysis?
Best Regards,
Angelia
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
118 | |
101 | |
71 | |
61 |