Statistical programming, matrix languages, and more

Randomly selecting a number with interval (Ai+1, Ai-1) and solving for times

Reply
Super Contributor
Posts: 289

Randomly selecting a number with interval (Ai+1, Ai-1) and solving for times


This is the codes that I am trying to write;

Please I need help in the commented section.

Any expert in proc iml in Boston?

I want to randomly select and number in the interval Col[i+1, j] and Col[i-1, j] and solve fo times.

proc iml;

      use Complete;

    read all var _all_ into DM;    

      close;

    frequency =DM[,5]; y =DM[,4]; Censored= DM[,2]; time = DM[,1];

      use GIB;

    read all var _all_ into Col;   

print Col;

/***THIS IS WHERE I NEED HELP****/;

/****** I need to generate a UNIFORM in the interval , for example U[1&2] is any random number in the interval Col[1, j] and Col[2, j]****/;

/****** I need to generate a UNIFORM in the interval , for example U[i-1&i+1] is any random number in the interval Col[i+1, j] and Col[i-1, j]****/;

/*** I need Help to Complete this section*******/;

timeS=J(nrow(time),1,1);

do j=1 to m;

if censored[1]=1 then timeS[1]=time[1]+((Col[1,1]-U[1&2,1])/(Col[1,1]+col[1,2]))*(time[2]-time[1]); else if censored[1]=0 then timeS[1]=time[1];

if censored=1 then timeS=time+((Col[n,1]-U[n&n-1,1])/(Col[n,1]+col[n,m-1]))*(time-time[n-1]); else if censored=0 then timeS=time;

end;

do i = 2 to n-1;

do j= 1 to m;

if censored[1]=1 and Col[i,j]=1 then timeS[i-1]=time[i-1]+((Col[i-1,j]-U[i-1&i+11,j])/(Col[i-1,j]+col[i+1,j]))*(time[i+1]-time[i-1]); ; else if censored=0  then timeS=time;

end;

print segment;

Ask a Question
Discussion stats
  • 0 replies
  • 245 views
  • 0 likes
  • 1 in conversation