
Two dimensions in Line chart, not working
Fernando Obara Suzuki May 16, 2011 1:13 PM (in response to Nicolai Jørgensen)Hi Nicolai,
I think that the problem with your line chart is that it doesn't support the above() function. This function can only be used in tables (pivot or straight).
Sorry but I'm not sure on how you show fix your graph. I'm not an expert yet...
Regards,
Fernando

Two dimensions in Line chart, not working
Nicolai Jørgensen May 16, 2011 3:05 PM (in response to Fernando Obara Suzuki )Hi Fernando
Thank you. I think in fact 'above' does work with line charts and tables (not pivot though), and it works fine with only one dimension (as in the qvw attatched). Worst case, I will try out other ways of calculating to get the desired result.
PS: It might seem easy to do the calculations in the loadscript with peek function (and it is), but I want all the dynamics from doing the calculations in the objects, e.g. being able to do whatever selections in various fields. Since the results are dependent on the result from previous calculated field, this would be lost if it was calculated in the loadscript (fixed).
Kind regards
Nicolai

Re: Two dimensions in Line chart, not working
John Witherspoon May 16, 2011 4:07 PM (in response to Nicolai Jørgensen)I'd just calculate your cumulative survival by looking at how many are alive at that time vs. the total number. Granted, that's not exactly equivalent to your calculation, but your calculation seems wrong to me. for intance, in Type 1, ID24 did NOT die, yet when ID20 subsequently dies, you go from a 2/7 survival rate to a 0/7 survival rate. That makes no sense to me. Shouldn't the death of ID20 take you to a 1/7 survival rate, as ID24 is still alive, even if she is no longer at risk? I guess I just don't understand what you're doing.
Of if you're saying that ID24 was removed from the population without dying at time 70, then the % should change at that point from 2/7 to 1/6 I'd think, or even all the earlier numbers should be changed to reflect 6 in the population. But that's not hat you're doing either.
Calculated as if the censored=1 are simply survivors, do this to your chart:
 change your calculated dimension to just Timescale
 remove all expressions
 add this expression: count(if(Time>TimeScale or Censored=1,ID))/count(ID)
 stop suppressing zeros
 continuous axis, min=0, max=max(Time)
If that's not exactly what you want, that's still the basic idea I'd use. Just calculate each line separately and not by referring to all the other lines that came above it.
It may also be worth changing your data model to not require an island dimension if you have a lot of data to process, as having a count(if()) will be slow. Since I'm not really understanding your data, I'm not sure what sort of data model you'd want, but I don't mean precalculating anything. I just mean having the right connections in your data model to do the work for you.

Re: Two dimensions in Line chart, not working
Nicolai Jørgensen May 16, 2011 4:23 PM (in response to John Witherspoon )Hi John
Thank you.
I guess the chart does need some more explanation:
The censored records should be included in the caldulations just like the rest until the time of censoring, but should not be included afterwards, all numbers before that remaining as they were. After a censored point, the there will be a bigger decrease per death/failure than before.
It is the censoring part that makes it difficult. I had started with a calculation just as you suggest, calculating points as count of those IDs have Time > TimeScale. The result is great untill the censoring accours.
The plot (Kaplan Meier) is explained in the attached pdf (simple fly example) and is used within pharma/medico industry in medical trials. There, the calculations are done in SAS (Proc Lifetest).
http://en.wikipedia.org/wiki/Kaplan%E2%80%93Meier_estimator
Nicolai



Re: Two dimensions in Line chart, not working
Nicolai Jørgensen May 27, 2011 3:56 AM (in response to Nicolai Jørgensen)Ok. Went around the problem, by gathering the data to be calculated on, sent it out and did a partial reload with all the calculations in the load script. Works very well. Then, instead of two dimensions and two expressions, I recoded to fit all in two dimensions and one expression instead. Now the graphs look just as I want them to.
Thanks for input guys. Untill next time.
/Nicolai

Re: Two dimensions in Line chart, not working
Lee Matthews Oct 6, 2013 9:29 PM (in response to Nicolai Jørgensen)Here is an example of how to create the Kaplan Meier Curve

Re: Two dimensions in Line chart, not working
Nicolai Jørgensen Oct 7, 2013 4:32 AM (in response to Lee Matthews )


Re: Two dimensions in Line chart, not working
Rochelle John Oct 7, 2013 4:49 AM (in response to Nicolai Jørgensen)Hi Nicholai,
Please share your expressions and dimensions.
Rochelle