Linear regression in Raster Calculator

2527
3
06-03-2013 07:49 AM
AnnaReye
New Contributor
Hi all,

I would like to use a linear regression equation to compute a grid of estimated values in ArcView 9.3.1.
The coefficients have already been obtained and I only need to put them into Raster Calculator. However, I am having troubles with the syntax.

For example, the data table of my layer "soil type" contains the fields "values", "count" and "wrbuf", the latter field containing the variables of the linear regression. The variables are called for example "HSeu" or "CMcr".
I have another layer with data on vegetation structure containing fields "values" and "count". Here, the field "values" contains the variables which are called e.g. "1" or "2". These numbers encode for a type of vegetation.

The regression should look like this:

output = 293.1 + (-15.3 * "HSeu") + (-0.6 * "CMcr") + (-1.5 * "1") + (-2.7 * "2")

What is the correct syntax for this in the Raster Calculator?

Thank you very much for your help,

Anna
0 Kudos
3 Replies
curtvprice
MVP Esteemed Contributor
Anna,

You need to use the Lookup() tool to get at raster attributes, and "Con" to pick your coefficient from the vegstruct grid; this would be something along the lines of:

293.1 + (-15.3 * Lookup("soil type","HSeu")) + \
  (-0.6 * Lookup("soil type","CMcr")) + \
  (Con("vegstruct" == 1, -1.5, Con("vegstruct" == 2, -2.7)))
0 Kudos
AnnaReye
New Contributor
Hi Curtis,

thanks for your reply. Unfortunately, the lookup tool does not work, I receive following error messages:

Syntax error at or near symbol ,.
Syntax error in parsing grid expression.

In order to solve my problem, I have now created individual raster files per variable, which I can multiply with my coefficient to calculate my regression. This works quite nicely (I don't get an error message), however, the created output layer cannot be visualized on the map (when activated). I have tried "zoom to layer" and simplifying the equation, but the problem stays the same. Opening and closing of the project and program does not help either...

Do you have an idea how to solve this problem?

Thanks!
0 Kudos
curtvprice
MVP Esteemed Contributor
Unfortunately, the lookup tool does not work, I receive following error messages:

Syntax error at or near symbol ,.
Syntax error in parsing grid expression.


Can you share your expression that does not work? I do not see ",." anywhere in the expression I posted first. My guess is you may have some model variables that are misspelled or tools that incorrectly capitalized.
0 Kudos