[R-sig-Geo] apply monte carlo simulation for each cell in a matrix (originally raster)

Diann Prosser dprosser at usgs.gov
Tue Mar 13 06:30:18 CET 2012


Robert, thank you very much! I believe this sets me on the right path.

2 issues I'm looking into:

1) I do receive an S4 error after the as.matrix(x) step:
> as.matrix(x)
/Error in as.vector(data) : 
  no method for coercing this S4 class to a vector/

2) Perhaps related, I'm not sure if I'm losing the variance measures around
the estimate (mean risk) or if I'm not using the correct function to
retrieve them. For example, "summary(node)" should give me the median, mean,
2.5% and 97.5% variance measures for each cell. "summary(x)" gives me:

> summary(x)
Cells:  4 
NAs  :  0            
Min.     77.36
1st Qu. 114.10
Median  126.70
Mean    118.30
3rd Qu. 130.90
Max.    142.30


which is information summarized across the matrix.
             [,1]     [,2]
[1,] 142.13677 125.7188
[2,]  75.59303 128.8319
 
Ultimately, I want matrix/raster outputs for mean risk, plus the upper and
lower bounds.
Will keep digging. Thank you for your time!



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/apply-monte-carlo-simulation-for-each-cell-in-a-matrix-originally-raster-tp7367094p7367555.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list