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?

  • $\begingroup$ Thank you, I will fix the code. My question is related to interpretation of the results and not the software. $\endgroup$
    – Saraz
    Nov 5, 2019 at 4:59
  • $\begingroup$ 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? $\endgroup$ Nov 5, 2019 at 9:11
  • $\begingroup$ 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? $\endgroup$
    – Saraz
    Nov 5, 2019 at 20:54
  • 1
    $\begingroup$ It likely means your model is unidentifiable, you should consider using a random effect for location instead. $\endgroup$ Nov 5, 2019 at 22:53


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.