Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Apr 11, 2015
1 parent e140112 commit 502f346
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions man/binMeans.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,27 @@ mu <- double(length(x))
mu[1:50] <- 5
mu[101:150] <- -5
y <- mu + rnorm(length(x))
outliers <- c(25:30,175:180)
y[outliers] <- y[outliers] - 5

# Binning
bx <- c(0,50,100,150,200)+0.5
yS <- binMeans(y, x=x, bx=bx)

# Plot
plot(x,y)
for (kk in seq(along=yS)) {
lines(bx[c(kk,kk+1)], yS[c(kk,kk)], col="blue", lwd=2)
}

# Weighted binning
w <- rep(1, times=length(x))
w[outliers] <- 0.1 # Down-weight outliers
ySw <- binMeans(y, w=w, x=x, bx=bx)

for (kk in seq(along=yS)) {
lines(bx[c(kk,kk+1)], ySw[c(kk,kk)], col="red", lwd=2)
}
}

\seealso{
Expand Down
3 changes: 2 additions & 1 deletion man/matrixStats-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
}

\section{How to cite this package}{
Henrik Bengtsson (2015). matrixStats: Methods that Apply to Rows and Columns of a Matrix. R package version 0.14.0. https://github.com/HenrikBengtsson/matrixStats
Henrik Bengtsson (2015). matrixStats: Methods that Apply to Rows and Columns of Matrices (and to
Vectors). R package version 0.14.0-9000. https://github.com/HenrikBengtsson/matrixStats
}

\author{Henrik Bengtsson, Hector Corrada Bravo, Robert Gentleman, Ola Hossjer, Harris Jaffee, Peter Langfelder}
Expand Down

0 comments on commit 502f346

Please sign in to comment.