Displaying 2 results from an estimated 2 matches for "ylength".
Did you mean:
length
2008 Jul 20
3
asp and ylim
#See David Williams' book "Weighing the odds", p286
y <- c(1.21, 0.51, 0.14, 1.62, -0.8,
0.72, -1.71, 0.84, 0.02, -0.12)
ybar <- mean(y)
ylength <- length(y)
ybarv <- rep(ybar, ylength)
x <- 1:ylength
plot(x,y,asp=1,xlab="position",ylab="ybar",type="n",ylim=c(-1,1))
segments(x[1], ybar, x[ylength], ybar)
segments(x,ybarv,x,y)
points(x, ybarv, pch=21, bg="white")
points(x,y,pch=19,col="bl...
2013 Mar 25
1
Newbie code to count runs of up or down moves
There are probably many mistakes with this code. I am used to coding in C
with a debugger, so I am very new to coding in R without one and different
syntax. My code in the upper left panel of R Studio
isz<-c(3,1,4,5,2,1,0,3,5,8)zlength(z)y<-c(0,0,0,0,0,0,0,0,0,0)ylength(y)zdiff
= diff(z)zdiffn<-length(zdiff)nx<-zdifff<-function(x) {
for (k in 1:n){ for (i in 1:n-k){ if
(all(x[i] * x[i-1] > 0) && ((x[i+k+1] * x[i+k]) < 0)
y[k]<-y[k]+1 }...