Mercurial > repos > vipints > rdiff
view rDiff/src/locfit/m/lf_censor.m @ 2:233c30f91d66
updated python based GFF parsing module which will handle GTF/GFF/GFF3 file types
author | vipints <vipin@cbio.mskcc.org> |
---|---|
date | Tue, 08 Oct 2013 07:15:44 -0400 |
parents | 0f80a5141704 |
children |
line wrap: on
line source
function fit = lf_censor(x,y,cens,varargin) % % Censored local regression using normal assumption. % Must provide x, y and cens. % All other arguments to locfit() can be provided, with the % exception of weights. % % NEED: Kaplan Meier Estimate. Iterations are fixed. % lfc_y = y; unc = find(~cens); for i = 0:3 fit = locfit(x,lfc_y,varargin{:}); fh = fitted(fit); rs = rsum(fit); df0 = rs(1); df1 = rs(2); rdf = sum(1-cens) - 2*df0 + df1; sigma = sqrt(sum( (y-fh).*(lfc_y-fh) / rdf)); sr = (y-fh)/sigma; lfc_y = fh + sigma*normpdf(sr)./normcdf(-sr); lfc_y(unc) = y(unc); end; return;