Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

lf_censor.m 610 B

1234567891011121314151617181920212223242526272829
  1. function fit = lf_censor(x,y,cens,varargin)
  2. %
  3. % Censored local regression using normal assumption.
  4. % Must provide x, y and cens.
  5. % All other arguments to locfit() can be provided, with the
  6. % exception of weights.
  7. %
  8. % NEED: Kaplan Meier Estimate. Iterations are fixed.
  9. %
  10. lfc_y = y;
  11. unc = find(~cens);
  12. for i = 0:3
  13. fit = locfit(x,lfc_y,varargin{:});
  14. fh = fitted(fit);
  15. rs = rsum(fit);
  16. df0 = rs(1);
  17. df1 = rs(2);
  18. rdf = sum(1-cens) - 2*df0 + df1;
  19. sigma = sqrt(sum( (y-fh).*(lfc_y-fh) / rdf));
  20. sr = (y-fh)/sigma;
  21. lfc_y = fh + sigma*normpdf(sr)./normcdf(-sr);
  22. lfc_y(unc) = y(unc);
  23. end;
  24. return;