[R-sig-Geo] Raster regression cooeficients plot?

eddie eddieatr at gmail.com
Thu Jun 16 10:29:13 CEST 2011


Dear Robert, 

Thank you very much for your reply. Sorry for not giving you enough
information in order for you to give comments on what are the 8 coefficients
generated. The full code is as below. My rasterbrick contains 365 layers. 

library(raster)
setwd("C:/mydata")
getwd()
# define raster layer
r <- raster(ncol=69, nrow=43, xmn=96.5, xmx=165.5, ymn=-16.5, ymx=26.5)
# build rasterstack and then rasterbrick
s = stack(list.files(pattern='*.rst'))
b = brick(s)
# fit linear model
time <- 1:nlayers(b) 
fun=function(x) { if (is.na(x[1])){ NA } else { m = lm(x ~ time);
summary(m)$coefficients}}
x3 <- calc(b, fun)
plote(x3)
# end

Thank you.


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Raster-regression-cooeficients-plot-tp6478377p6482176.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list