I am a beginner with statistics and R and have no clue on how to model my data. I have collected information on seed traps (ID) that includes the habitat type (Hab) and different measures of distances. Also I have applied a modularity analysis, so that the seeds traps are grouped into modules. My dataset looks like this:

 ID Hab Module DistEdge MeanDist1 MeanDist2 MeanDist3
F48   F      A   21.768    24.941     6.033    27.642
F50   F      E   35.666    60.505   149.927    48.582
F52   F      B   12.243   103.041    72.908   102.375
N02   N      B   58.681   129.590   127.344   131.383
N17   N      B   62.829    72.827    76.736    77.644

I am looking for a way to analyze if there is any correlation between the Module classification and the other variables. My difficulties here are:

1 - is there a way to model my data where Module is the response variable (something like Module~Hab*DistEdge*MeanDist1) ? If so, which model should I use (I only have a bit of experience with glm) and which distribution?

2 - Is that a problem if I have different types of predictor variable (factor and numerical)?

  • $\begingroup$ This is basically a classification problem. Have a look at the rpart package. $\endgroup$
    – jlhoward
    Commented Sep 9, 2015 at 8:54

1 Answer 1


There are several methods, perhaps the most common is multinomial logistic regression. In R you can use the multinom function in the nnet package:

m1 <- multinom(Module~Hab+DistEdge + MeanDist1 + MeanDist2 + MeanDist3)

Other possibilities include trees (with rpart or party or another package), multinomial probit (quite similar to multinomial logistic, usually), discriminant analysis (but it makes a lot of assumptions).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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