Below there is a code that works fine and it generates two correlated variables based on bivariate normality. I then want to naively use the Cox model to model one based on the other. When I ask for the survival curve of the one (say the response) at a given value of the other (say the covariate) fixed at a value close to its mean I get a behavior of the survival "cutting down" to 0 in spite of the fact that the cumulative hazard is looking good at the same range of support. The problem is that the survival (being exp(-H)) is getting really small due to large values of the H so MATLAB outputs that as 0 while it is not. Is there a way around it so that I can visualize the full tail of the survival curve at the third panel of the generated plot?
I know this is not the way to generate values from the Cox model. However I do want to generate bivariate normal data and then pretend one is the response and the other is the covariate. More specifically I would like to see how this process works for high correlation values, but the higher the correlation the stronger the problem. If I set "rhoreal=0" (which is the correlation) then it works fine (probably because of the smaller values of H).
Wa=mvnrnd([m1a m2a]',[s1a^2 mycov;mycov s2a^2],na);
statusA=zeros(na,1); % Have this as a column of zeros equal to the length of the scores
%I have generated two correlated varianbles x1a x2a and I want to
%naively apply the Cox model with one as a response and the other
%as a covariate. I KNOW THAT THIS IS NOT THE WAY TO SIMULATE FROM A COX
%MODEL. The Cox model follows:
[b,logL,H0,st] = coxphfit(x1a,x2a,'Baseline',0);
title('Baseline Cumulative Hazard')
title('survival curve given the value of the covariate =7')
%Is there a way of completing the tail of the survival curve in the
%last panel. It "cuts down" to zero but this a numerical issue due
%the survival begin exp( -large number).