Skip to content

TSA error using packet 1 any (sp) is not TRUE

1 message · yasmine mohamed

#
Hello Guys,

I am trying to do Trend Surface Analysis (TSA) via OLS as rainfall function of longitude and latitude. This TSA needs spatialgriddataframe which is grd. The code went fine, but the graph has the following message written inside

error using packet 1 any (sp) is not TRUE

Here is my Code:

rain.tsm <- lm(rain~I(LON^2)+ I(LAT^2)+I(LON*LAT), data=yr757.eda)

summary(rain.tsm)

library(sp)

gridded(grd) = TRUE # Make it a grid

grd$tsm.pred <- predict(rain.tsm, grd)

pts <- list('sp.points', yr757.eda, pch=1, cex=0.7, col='black')

spplot(grd, zcol='tsm.pred', first= FALSE, scales=list(draw=T), main="Rainfall Estimates (Trend Surface Model)", sp.layout=pts)

Cheers,
Yasmine