# Spatial regression: random and fixed effects [closed]

I'm working with spatial data (two rasters or matrix in the attached Figure), that is distributed in a 2D-space and each grid has a value. The two grids have the same number of cells.

Variable "Y" is a summary statistic defining "diversity". Such value is estimated from "yi"...."yn", where "n" is 12 for each square. Therefore I will have "Y" from "j" to "N", where "N" is the number of grids.

I would conclude that variable Y is subjected to a fixed effect (related to Variable X) and a random effect (related to spatial autocorrelation and "n").

My objective is to assess whether exist a correlation between the two variables and model it throughout spatial regression.

What I did to start with, it was to explore my data and plot them as in the following Figure:

As you can see in the raster for variable Y, the blue points are much less than the red or orange points. My concern is that these differences in sample sizes (if this is the correct statistical term) between blu, orange and red cells, can affect the reliability of the correlation and spatial regression analysis. Is this correct?

My questions are:

1) If differences in sample size across data points with a certain Y values can affect the spatial regression.

2) How can I reduce the random effect when I plot the data? Would be correct to use the mean values for observations that have the same or similar X value? And then make the spatial regression on these averages?

## closed as unclear what you're asking by whuber♦Dec 3 '18 at 14:42

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Your problem is stated so abstractly that it is difficult to determine how to respond. Would it be possible to describe your data and your objectives more concretely? – whuber Dec 2 '18 at 17:16
• Parts of it are, but I'm afraid your intended meanings of "independent markers," "statistical drift," "much less," "sample sizes," "variable number of observations," and "data attributes of observation" remain obscure. And do you intend that the two grids differ in extent and dimensions, as suggested by the illustration? – whuber Dec 2 '18 at 18:52
• No, the extent of the two grids is the same. The variable y (for each square) is estimated from 12 independent events. The number of events may affect the precision of the estimate of the variable y in each square. Another problem is the fact that i have a different number of square for each colour. Could this affect the reliability of the spatial regression and correlation analyses? – CafféSospeso Dec 2 '18 at 20:12
• @whuber, is it more clear the question? – CafféSospeso Dec 3 '18 at 19:35