search for: sdratio

Displaying 1 result from an estimated 1 matches for "sdratio".

Did you mean: ratio
2004 Apr 08
2
Clever R syntax for extracting a subset of observations
...seq(1,10) d = c(7,3,2) and if I say y = x[d] then I get the vector y as (7,3,2). Very clever! This idea is used intensively with the boot library. Now consider the following code (which works): --------------------------------------------------------------------------- library(boot) sdratio <- function(D, d) { return(sd(D$x[d])/sd(D$y[d])) } x = runif(100) y = 2*runif(100) D = data.frame(x, y) b = boot(D, sdratio, R=1000) cat("Standard deviation of sdratio = ", sd(b$t[,1]), "\n") ---------------------------------------------------------------...