Empirical CDF with data containing left censored, exact and right censored failures.
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
My data consists of left censored, exact failures and right censored points. I am trying ecdf by considering data in two different forms.:
- I create data as two column matrix. for left censored i use [-Inf, observed value], for exact failures i use [observed value, observed value] and for right censored i use [observed value, Inf] as per the documentation. and now I do [f,x] = ecdf[Data]
- Next I create a single column vector of my Data, and I create a second vector as censoring data and use -1 for left censored, 0 for exact and 1 for right censored. I calculate the cdf using [f,x] = ecdf[Data1,'Censoring',censoring_data_vector;
According to documention, ecdf ignores if the data is two colum matrix and performs cdf calculations, other wise uses the censoring information. Both should be exactly same but i get totally different answers and i believe the first one is giving more reasonable answers than the second one. Please help what am I doing wrong in my second method? Thanks in advance. I can provide the data if someone wants to try it.
1 Commento
Kasumi Tsutsumi
il 12 Apr 2023
Hi, I have the same problem. Was there something helpful for this problem?
Risposte (1)
Aditya
il 24 Gen 2024
Modificato: Aditya
il 24 Gen 2024
Hi Pappu,
I understand that you are facing some issues with using ecdf function.
The MATLAB function ecdf can handle censored data when provided with a censoring vector, where the censoring information is given as -1 for left-censored, 0 for exact, and 1 for right-censored data points. However, the way you are describing the use of ecdf with a two-column matrix is not standard and may not be supported directly by the function. The typical usage of ecdf for censored data is with a single column vector of data and a corresponding censoring vector.
Here is the correct way to use ecdf with censoring:
% Data1 is a single column vector of observed values.
Data1 = [ ... ]; % Replace with your data
% Censoring_data_vector is a vector of the same length as Data1 where:
% -1 corresponds to a left-censored observation
% 0 corresponds to an exact failure (uncensored observation)
% 1 corresponds to a right-censored observation
censoring_data_vector = [ ... ]; % Replace with your censoring data
% Convert censoring vector to logical where 0 is uncensored and 1 is censored
censoring_logical = censoring_data_vector ~= 0;
% Use ecdf with the censoring vector
[f, x] = ecdf(Data1, 'Censoring', censoring_logical, 'Function', 'survivor');
Please ensure that you are using the 'Censoring' option correctly with a logical vector, where true (1) indicates a censored observation and false (0) indicates an exact failure. The 'Function' option set to 'survivor' will compute the survivor function, which is 1 minus the empirical CDF, a common choice when dealing with censored data.
If you are still getting different results between the two methods you described, it's likely due to a misunderstanding of how ecdf handles the two-column matrix input. The function does not natively support a two-column matrix where the columns represent left and right censoring limits. Instead, it expects a single column of data points and an optional logical censoring vector.
If you provide the data, I can help you debug the issue further. However, I can only give you guidance and cannot run the code myself. Please make sure that the censoring vector is correctly specified as a logical vector, where true indicates a censored observation, and that you are using the 'Censoring' option correctly in the ecdf function call.
Hope this helps.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!