# Linear model from iterative process in R

I would like to test a relationship between to factors such as birds occurrence and temperature for instance, to test if temperature affects birds occurrence from a country (e.g. Germany).

I have a sample of 200 points from Germany taken randomly.

I extract from those points the temperature and birds occurrence values.

I repeat the sampling of 200 random points 100 times, in a way that I compute 100 iterations of a linear model lm(birds occurrence ~ temperature) -> lm_model.

I choose to proceed by iteration, as 200 points alone are not representative of the entire country, and as spacial auto-correlation issues will pop-up if I take into account all location points from Germany at once. Nb: the aim is to process a linear model removing spatial autocorrelation effect without using a Spatial Autoregression error model (SARerr).

At the end, I have 100 lm_model output, with vectors of 100 p-values, 100 slopes and 100 standard errors values. I would like to extract from those:

• one p-value representative of all 100 p-values generated,
• one slope (=estimate) to know if my relationship is positive or negative,
• one standard error.

Example of code (with birds_list[[i]] a list with 200 birds occurrence values):

for(i in 1:100){
lm_model <- summary(lm(birds_list[[i]]~ temperature_list[[i]]))
lm_estimate[[i]] <- lm_model[[4]][2,1]
lm_std_error[[i]] <- lm_model[[4]][2,2]
lm_pv[[i]]  <- lm_model[[4]][2,4]
}


Concerning the p-value, I used so far the so called 'sum of logarithm' https://www.rdocumentation.org/packages/metap/versions/1.0/topics/sumlog which seems fine, but for the slope and standard error, I am not sure how I can do that ... Not sure if taking a mean / median would be correct ...

Does the overall approach seem correct? Does anyone would have a suggestion on a way of generating the slope or standard error values?

• The spatial correlation across samples will make your p values etc. correlated in a very complex way, thus biasing the results of the pooling step. Why avoid standard techniques that deal with spatial dependence? – Michael M Sep 1 '18 at 21:29
• Thank you for your reply ! I wanted to avoid the use of SAR because I got this kind of results: onlinelibrary.wiley.com/doi/full/10.1111/… . But maybe I still should use it and acknowledge the limitation/bias of the model in the discussion?... Even though I would like my results to be the most reliable. – Roxanne Sep 2 '18 at 7:53
• There are other modelling techniques such as mixed effects models with spatial correlation or IML to consider. – Michael M Sep 2 '18 at 8:07
• If you want to combine the slopes (or any other estimate) you might consider using meta-analysis with inverse weighting. Since you are using R you might like to look at the packages metafor or meta both of which are available from CRAN. – mdewey Sep 2 '18 at 9:38