subseting dataframe conditions on factor(binary) column(vector in r language) -


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

assume records of remission or not taken @ discrete times,

how can check markov property each patient, summarize findings, assumption probability of remission patient @ time depends if patient had remission last time/not remission last time(same thing saying probability of remission patient @ time depends if patient had remission in previous row, if not first observation)

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

easy understand if understand markov property

this exercept of df

patientid remission

ju67       1  ju67       0  ju67       0  ju88       1  ju88       1  ju23       1  ju23       0 

any ideas? subsetting dataframe required condtions computing probabilities using 'msm' package or (probably better way) viewing state transitions table work how do this, subsets of dataframe need example include patients 3 consecutive 0's in remission(including 0 in remission now) , compare subset of dataframe 2 consecutive 0's in remission(including 0 in remission now) –


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -