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

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


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!

        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide 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 Please read the posting guide before posting to the list.

list of date sections of archive