1
$\begingroup$

In my PhD thesis I am working on spatial modeling of different chemical parameters in groundwater, and for spatial modeling I am also using the multiple statistical approach. I have a question about multiple regression analysis. (Or it is better to use polynomial regression?)

The equation for spatial regression modeling is: $Y = α + β_1x_1 + β_2x_2 +.... + β_ix_i + ε$

For my dependent variable, I have concentrations of calcium in groundwater, which were measured from different sampling points in the entire research area. For the independent variable, I choose the spatial data that influence the distribution of calcium in groundwater. I have lithology, vegetation, slope, climatic conditions (temperature, precipitation), depth of soil, ...

The problem is that lithology and vegetation are categorical data (lithology = 3 categories from 1 to 3, where 1 means clastic rocks, 2= carbonate rocks and 3= metamorphic and igneous rocks; and vegetation = 4 categories (1= bare rocks, 2= agriculture land, 3= grassland, 4= forests); all others variables are numerical and continuous.

Do you have any idea how to solve the problem with categorical data in multiple regression analysis? Might it be better to use some other method? Best regards and thank you very much for your help.

$\endgroup$
  • $\begingroup$ With spatial data it's usual to take into account, or at any rate check for, correlation between nearby locations that's not captured by the predictors. Plot a semi-variogram of the residuals from your fitted model. $\endgroup$ – Scortchi - Reinstate Monica Nov 14 '14 at 12:58
3
$\begingroup$

It's a little unclear what your objectives are, so other methods might be preferable depending on those. Polynomial regression may suit continuous variables, but wouldn't make sense for categorical ones. You can add higher-order terms for the continuous variables alongside categorical predictors though.

Nominal predictors can be added to a multiple regression model using dummy codes. In your case, you could enter lithology as two dummy variables: using clastic rocks as the reference group (for example; not necessarily the one you want to choose), you could create one binary variable indicating whether a case involves carbonate rocks (1 if so, 0 if not), and another equivalent one for metamorphic/igneous rocks. The same process of dummy coding can work for any number of levels, and won't be too much harder to interpret for vegetation. Here's an example dataset: $$\begin{array}{c|cccccc}\rm Case&\rm Carbonate&\rm Metamorphic/Igneous&\rm Farm&\rm Grass&\rm Forest&...\\\hline\small\rm Clastic\ bare&0&0&0&0&0&...\\\small\rm Carbonate\ bare&1&0&0&0&0&...\\\small\rm Igneous\ bare&0&1&0&0&0&...\\\small\rm Clastic\ farm&0&0&1&0&0&...\\\small\rm Carbonate\ farm&1&0&1&0&0&...\\\small\rm Igneous\ forest&0&1&0&0&1&...\\...&...&...&...&...&...&... \end{array}$$See how that works? (I can elaborate if not.) Just enter these binary predictors like any other. The corresponding $\beta$s represent the differences between given groups and the reference group.
E.g., $\beta_{\rm Carbonate}$ represents the difference between carbonate and clastic in the above example.

$\endgroup$
  • $\begingroup$ Nick, yes I can see how this works, you presented very clearly. I will do that. The objective of this research is a spatial distribution of calcium in groundwater based on statistical methods. That means that I have to "find the equation" or better algorithm which will present the best correlation between spatial indenpendent variables. Than I have to enter this equation in GIS and do moddeling. I only have some concerns about this method of regression, due to categorical data and than moddeling. So that is why I asked if there is any other method that would be better for moddeling calcium? $\endgroup$ – user49496 Jul 4 '14 at 10:03
0
$\begingroup$

Lets be careful in defining the problem. You have asked for couple of things here. You are talking about linear or polynomial , you are taking about categorical variables.

I see that Response variable Y is a continuous variable. So we can use R function lm(). Linear Models. Now your modeling problem has multiple Predictor variables x1,x2,..,xN. So we can do "Multiple regression analysis".

In lay-man term whether to use linear or polynomial equation ( quadratic or exp equation ) to fit your data really depends on the data self. In general polynomial equation tends to over-fit so be careful.

I see you are concerned about one more issue categorical variable. The good news is any categorical variable in R is represented as a factor. So you dont have to worry about it.

Now R code

fit1 = lm(Y ~ lithology + vegetation + X3 + X4, data = spatialdata)

This is your model. But you need to make sure you pass the multicollinearity test.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.