Message-ID: <DUB107-W649F6E7FC94975EE3E9E28D75C0@phx.gbl>
Date: 2012-11-29T09:15:24Z
From: Lorenzo Alfieri
Subject: calculate CRPS on rasters
In-Reply-To: <CANtt_hzGYYEk38TgYws+npfLwAg2Z6VG1fv0GW9YHjQiCvhbVw@mail.gmail.com>
Hi Robert,
I was hoping to use the overlay function too, but it seems it doesn't work in this case. See the result:
CRPS? <- overlay(obs, pred, fun=function(x,y) crps(x,y)$crps)
Error in function (x, fun, filename = "", recycle = TRUE, ...)? :
? cannot use this formula, probably because it is not vectorized
Lorenzo
Date: Wed, 28 Nov 2012 11:25:36 -0800
Subject: Re: [R-sig-Geo] calculate CRPS on rasters
From: r.hijmans at gmail.com
To: alfios17 at hotmail.com
CC: etiennebr at gmail.com; r-sig-geo at r-project.org
Lorenzo,
Given that solution, I think you can also express this?(in a memory-safe fashion)?like this :
CRPS??<- overlay(obs, pred, fun=function(x,y) crps(x, y)$crps)
Robert
On Tue, Nov 27, 2012 at 3:11 AM, Lorenzo Alfieri <alfios17 at hotmail.com> wrote:
Etienne,
thank you for the tip
Now it runs trough, by using
CRPS <- raster(ncol=10, nrow=10)
CRPS[] <- crps(obs[],pred[])$crps
Lorenzo
Date: Mon, 26 Nov 2012 21:37:13 -0500
Subject: Re: [R-sig-Geo] calculate CRPS on rasters
From: etiennebr at gmail.com
To: alfios17 at hotmail.com
CC: r-sig-geo at r-project.org
Lorenzo,
I don't know about your specific function, but you can access matrix using the []'s. So maybe something like :
CRPS <- raster(ncol=10, nrow=10)
CRPS[] <- crps(obs[],pred[])
Etienne
2012/11/26 Lorenzo Alfieri <alfios17 at hotmail.com>
CRPS <- raster(ncol=10, nrow=10)
for (i in 1:length(obs)){
? CRPS[i] <- crps(obs[i],pred[i])$CRPS
? ? ? ? [[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo