Hello, I am new to R, so forgive my ignorance on what is probably simple. I find package simpleboot quite useful for LOESS bootstrapping and generation of plots. I want to calculate the standard error for x=60 of the 100 grid points and 50 bootstraps. The code below gives the first fitted value. How can I grab the other 49 values easily? I could do it one at a time for 50 bootstraps, but this becomes tedious for say 2000 bootstraps. Thanks for any help. library(simpleboot) library(bootstrap) attach(cholost) set.seed(13579) lo <- loess(y ~ z, data=cholost, span=.5, degree=2, family="gaussian", method="loess") lo.b <- loess.boot(lo, R=50, rows = TRUE, new.xpts = NULL, ngrid = 100, weights = NULL) lo.b$boot.list$"1"$fitted[60] -- Terry W. Schulz Applied Statistician 1218 Pomegranate Lane Golden, CO 80401 terrywschulz at comcast.net (303) 526-1461
Terry W. Schulz wrote:> Hello, > I am new to R, so forgive my ignorance on what is probably simple. > I find package simpleboot quite useful for LOESS bootstrapping and > generation of plots. > I want to calculate the standard error for x=60 of the 100 grid points > and 50 bootstraps. > The code below gives the first fitted value. > How can I grab the other 49 values easily? > I could do it one at a time for 50 bootstraps, but this becomes tedious > for say 2000 bootstraps. > Thanks for any help. > > library(simpleboot) > library(bootstrap) > attach(cholost) > set.seed(13579) > lo <- loess(y ~ z, data=cholost, span=.5, degree=2, family="gaussian", > method="loess") > lo.b <- loess.boot(lo, R=50, rows = TRUE, new.xpts = NULL, ngrid = 100, > weights = NULL) > lo.b$boot.list$"1"$fitted[60] >sapply(lo.b$boot.list, function(x) x$fitted) gives you the corresponding 100x50 matrix ... Uwe Ligges
Thank you for the perfect solution. Uwe Ligges wrote:> Terry W. Schulz wrote: > >> Hello, >> I am new to R, so forgive my ignorance on what is probably simple. >> I find package simpleboot quite useful for LOESS bootstrapping and >> generation of plots. >> I want to calculate the standard error for x=60 of the 100 grid >> points and 50 bootstraps. >> The code below gives the first fitted value. >> How can I grab the other 49 values easily? >> I could do it one at a time for 50 bootstraps, but this becomes >> tedious for say 2000 bootstraps. >> Thanks for any help. >> >> library(simpleboot) >> library(bootstrap) >> attach(cholost) >> set.seed(13579) >> lo <- loess(y ~ z, data=cholost, span=.5, degree=2, >> family="gaussian", method="loess") >> lo.b <- loess.boot(lo, R=50, rows = TRUE, new.xpts = NULL, ngrid = >> 100, weights = NULL) >> lo.b$boot.list$"1"$fitted[60] >> > > > sapply(lo.b$boot.list, function(x) x$fitted) > > gives you the corresponding 100x50 matrix ... > > Uwe Ligges > >-- Terry W. Schulz Applied Statistician 1218 Pomegranate Lane Golden, CO 80401 terrywschulz at comcast.net (303) 526-1461