# SpatioTemporal regression

I have a data-set containing rain value for 6 stations and station coordinates (lat,lon). I used lm function taking lat,lon,day, their interaction and rain as below:

G <- auto_basis(data = Rain[,c("lon","lat")] %>% *# Take dataset*

SpatialPoints(), # To sp obj
nres = 1, # One resolution
type = "Gaussian")

S <- eval_basis(basis = G, # basis functions
s = Rain[,c("lon","lat")] %>% # spat locations
as.matrix()) %>% # conv. to matrix
as.matrix() # results as matrix
colnames(S) <- paste0("B", 1:ncol(S)) # assign column names
Rain2<- cbind(Rain, S) %>% # append S to dataset
select( -mydate) # will not be using in the model
Rain_lm <- lm(z ~ (lon + lat + day)^2 + ., # model
data = select(Rain2,-id)) # omit station id
Rain_lm %>% summary()


The LM summary shows NA for Estimate regression coefficients and the standard errors Std. Error and of lat:lon interaction . Could you please help me to interpret the producing NAs?

• Thank you, I will fix the code. My question is related to interpretation of the results and not the software. – Saraz Nov 5 '19 at 4:59
• Spatiotemporal data cannot be reasonably assumed to be independent. A more appropriate model would account for measurements closer is space and time to be more strongly correlated. Are you familiar with mixed models? – Frans Rodenburg Nov 5 '19 at 9:11
• Hi Frans, yes I am working on my GAMM model now. Regarding the NAs can I interpret that the interaction between 'lat' and 'lon' does not affect the predictions and prediction standard errors using LM model in my case? – Saraz Nov 5 '19 at 20:54
• It likely means your model is unidentifiable, you should consider using a random effect for location instead. – Frans Rodenburg Nov 5 '19 at 22:53