1
$\begingroup$

i have a sequence of 1/0's indicating if patient is in remission or not,

assume the records of remission or not were taken at discrete times,

how can i check the markov property for each patient, then summarize the findings, that is the assumption that the probability of remission for any patient at any time depends only if the patient had remission the last time/not remission last time(same as thing as saying probability of remission for any patient at any time depends only if the patient had remission in the previous row, well if not first observation)

P(r at t=t+1|r=1 at t)=p(r at t+1|r=1 at t, r=0 at t=t-1, r=1 at t=t-2, r=1 at t=t-3)

easy to understand if you understand the markov property

this is an exercept of my df

patientId remission

ju67       1

ju67       0

ju67       0

ju88       1

ju88       1

ju23       1

ju23       0
$\endgroup$
0
$\begingroup$

Well the Markov property is that probability doesn't depend on the past. So you need to compute prob(rem == 1| currentrem == 0) and compare to prob(rem == 1| currentrem== 0 & prevrem==0) and prob(rem==1| currentrem==0 & prevrem ==1) etc. This will give you a number of different probabilities. You could use Fisher exact test to determine the likelihood that any two of the given conditions were drawn from a distribution with the same probability.

$\endgroup$
  • $\begingroup$ correct, how can i compute that in R, it should be simple, any ideas? and also say if i wanted to check longer down the line e.g. prob(rem == 1| currentrem== 0 & prevrem==0 & prevprevrem==0 ) $\endgroup$ – RampageKyd Apr 22 '15 at 17:30
  • $\begingroup$ If you have a data frame, using 'subset' will work. ?subset should give you enough information but for eg. something like nrow(subset(dataframe(df,currentrem==0&prevrem==0)) is the sort of thing you want to do. Not elegant, but it will work $\endgroup$ – aginensky Apr 22 '15 at 20:01
  • $\begingroup$ true, but how do i set those conditions for the data subset, by those conditions i mean like subset of dataframe where patients precisely have three consecutive 0's in remission(including the 0 remission now), then of course i could compare this to the subset of the dataframe with two consecutive 0's in remission(including the 0 remission now), subsetting sort of thing will work 'ret' or 'rle' could be useful :s $\endgroup$ – RampageKyd Apr 22 '15 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.