Search code examples
rstatisticsweibull

Function "estimate_cdf" not allowing me to select a method, does anyone know why?


I am working with a csv file, the file has 2 columns, one of them being a "C1A" which contain all the Time to failure hours and the other "Status", either 0 for censored points and 1 for censored points.

The estimate_cdf function in r studio: estimate_cdf(x, ...)

## S3 method for class 'wt_reliability_data'
estimate_cdf(
  x,
  methods = c("mr", "johnson", "kaplan", "nelson"),
  options = list(),
  ...
).

However, whenever i try to select a method, it always returns me a result with the "MR method". How do I get around this?

     dataset = read.csv("Test.csv")
     dataset$Failure = as.factor(dataset$Failure)
     dataset$Failure = 1 - as.numeric(dataset$Failure)
     dataset$Failure = 1 + as.numeric(dataset$Failure)
     > dataset


  C1A Failure
1   1027       0
2   3142       1
3   3423       1
4   3323       1
5    531       0
6   3547       0
7   3685       0
8   1122       0
9   1307       0
10   734       0
11  3913       0
12  2429       1
13  3297       1
14  1772       1
15  1148       1
16  2109       0
17   271       1
18  1346       0
19   297       1
20  2775       0
21  2485       1
22  1301       0
23  3360       1
24  1389       0

     estimate_cdf(dataset$C1A, status = dataset$Failure, methods = "johnson")

The 'mr' method only considers failed units (status == 1) and does not retain intact units (status == 0). CDF estimation for method 'mr':

# A tibble: 45 x 6
   id        x status  rank   prob cdf_estimation_method
   <chr> <int>  <dbl> <int>  <dbl> <chr>                
 1 ID57    146      1     1 0.0154 mr                   
 2 ID60    147      1     2 0.0374 mr                   
 3 ID86    184      1     3 0.0595 mr                   
 4 ID56    189      1     4 0.0815 mr                   
 5 ID90    203      1     5 0.104  mr                   
 6 ID17    271      1     6 0.126  mr                   
 7 ID19    297      1     7 0.148  mr                   
 8 ID33    322      1     8 0.170  mr                   
 9 ID89    329      1     9 0.192  mr                   
10 ID50    838      1    10 0.214  mr   

Alternatively,

> estimate_cdf(dataset$C1A, status = dataset$Failure, methods = "kaplan")
The 'mr' method only considers failed units (status == 1) and does not retain intact units (status == 0).
CDF estimation for method 'mr':
# A tibble: 45 x 6
   id        x status  rank   prob cdf_estimation_method
   <chr> <int>  <dbl> <int>  <dbl> <chr>                
 1 ID57    146      1     1 0.0154 mr                   
 2 ID60    147      1     2 0.0374 mr                   
 3 ID86    184      1     3 0.0595 mr                   
 4 ID56    189      1     4 0.0815 mr                   
 5 ID90    203      1     5 0.104  mr                   
 6 ID17    271      1     6 0.126  mr                   
 7 ID19    297      1     7 0.148  mr                   
 8 ID33    322      1     8 0.170  mr                   
 9 ID89    329      1     9 0.192  mr                   
10 ID50    838      1    10 0.214  mr   

It seems that it doesn't matter which method I select, R Studio resorts to "MR" everytime. Does anyone know why?

I've tried to choose from different methods, but it always returns "mr" in the cdf_estimation_method column.

I'm expecting it to change from "mr" to the selected method.


Solution

  • I am assuming you use the function estimate_cdf form the package weibulltools. There are actually multiple functions being documented with this name. In your case, you probably want to use the function for which the parameter is called method without the plural s at the end.

    estimate_cdf(dataset$C1A, status = dataset$Failure, method = "johnson")