[R] Proba( Ut+2=1 / ((Ut+1==1) && (Ut==1))) ?

Ben Fairbank BEN at SSANET.COM
Mon Apr 25 21:22:03 CEST 2005


These two expressions might be what you are looking for --

sum (3 ==
x[c(-length(x),-(length(x)-1))]+x[c(-1,-length(x))]+x[c(-1,-2)])
sum (-3 ==
x[c(-length(x),-(length(x)-1))]+x[c(-1,-length(x))]+x[c(-1,-2)])

Ben Fairbank


-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of vincent
Sent: Monday, April 25, 2005 11:03 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Proba( Ut+2=1 / ((Ut+1==1) && (Ut==1))) ?

Dear all,

First I apologize if my question is quite simple,
but i'm very newbie with R.

I have vectors of the form v = c(1,1,-1,-1,-1,1,1,1,1,-1,1)
(longer than this one of course).
The elements are only +1 or -1.

I would like to calculate :
- the frequencies of -1 occurences after 2 consecutives -1
- the frequencies of +1 occurences after 2 consecutives +1

It looks probably something like :
Proba( Ut+2=1 / ((Ut+1==1) && (Ut==1)))

could someone please give me a little hint about how
i should/could begin to proceed ?

Thanks
(Thanks also to the R creators/contributors, this soft
seems really great !)

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list