Re: [R] Root mean square on binned GAM results

From: David Jarvis <thangalin_at_gmail.com>
Date: Fri, 18 Jun 2010 18:26:34 -0700

Hi,

To calculate the mean of binned data from an arbitrary length vector 'd', the following works:

d1 <- runif( 67,0,9 )

while( length(d1) %% 5 != 0 ) {
  d1 <- d1[-length(d1)]
}

dmean1 <- apply( matrix(d1, 5), 2, mean )

Unfortunately, this means dropping (two) data points from the end before I can execute:

sqrt( mean( dmean1 - dmean2 ) ^ 2 )

Where 'dmean2' is an array of values constructed from running GAM on 'dmean1'.

What is a better way to do this?

Many thanks!
Dave

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 19 Jun 2010 - 01:28:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 19 Jun 2010 - 01:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive