[R] glm models with more than one response

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Fri Feb 5 19:10:33 CET 2010


Hi everyone,

I am trying to construct a glm and am running into a couple of questions.

The data set I am using consists of 6 categories for the response and 6
independent predictors representing nutrient concentrations at sample point
locations.  Ultimately I'd like to use the probabilities for each response
category in a simulation model such that these probabilities are used to
define a realized ecological niche.

When I  try the following it works for a single response.

Typha.glm <- glm(fwc$VegType == "Cattail"  ~ fwc$TP + fwc$TC + fwc$TN +
fwc$BD + fwc$LOI + fwc$Total_Mg, family = poisson)

But if I try this without specifying a specific VegType it fails.

plants.glm <- glm(fwc$VegType   ~ fwc$TP + fwc$TC + fwc$TN + fwc$BD +
fwc$LOI + fwc$Total_Mg, family = poisson)

Error in y + 0.1 : non-numeric argument to binary operator
In addition: Warning message:
In model.matrix.default(mt, mf, contrasts) :
 variable 'fwc$VegType' converted to a factor

My questions are:

1.  How can I extract the probability of the VegType for different
concentrations of each of the independent parameters?

2.  Do I need to run this model extracting for a specific VegType each time
or is there a way to run the glm for each VegType in one statement?

3.  I've experimented with binning each of the nutrient values to establish
frequency values for each VegType, but am uncertain how to reconstruct that
data into a common data set that can be submitted to the glm.  Is this step
even necessary ?

Running on Windows XP
R 2.10.1

Thanks and Much Appreciated

Steve

Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Steve_Friedman at nps.gov
Office (305) 224 - 4282
Fax     (305) 224 - 4147



More information about the R-help mailing list