[R] Sequences

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Wed Apr 8 11:39:35 CEST 2009


Hi Melissa,
so what you want to calculate is something like

S<-cumsum(lambs)-(1:length(lambs))*mean(lambs)

since (with x.bar=mean(x))
S_1=x_1-x.bar
S_2=S1+(x_2-x.bar)=x_1-x.bar+x_2-x_bar=x_1+x_2-2*x.bar
...
S_n=S_(n-1)+x_n-x.bar=sum_i (x_i)-n*x.bar

Eik.

m.mcquillan at lancaster.ac.uk schrieb:
> Hi,
>
> I am trying to perform a change point analysis. I know there is a function
> that does this but I am just out of university on an internship so they
> are trying to make me do it myself using this website :
>
> http://www.variation.com/cpa/tech/changepoint.html
>
> So if you look for CUMSUM on this you will see what I am trying to do but
> I'm not having much success!
>
> Melissa
>
>
>   

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790



More information about the R-help mailing list