Search code examples
rexcelcsvglm

Reading columns from csv to R with GLM


I'm trying to use a generalized linear model to analyze ecological food consumption data between 2 different species (N and NN):

dat1.glm<-glm(Contact~Density + Species, data=dat1, family=binomial)

I have attached an image which shows how the .csv file is formatted. After summary(dat1.glm), the result I get is

Coefficients:
        Estimate Std. Error z value      Pr(>|z|)  
(Intercept)  -0.1873     0.7494  -0.250   0.8026  
Density       0.2126     0.1049   2.027   0.0427 *
SpeciesNN    -0.2911     0.7650  -0.381   0.7035 

For some reason the variable "Species" shows up as "SpeciesNN" and I'm afraid this is skewing the results of the analysis. Any idea on how to fix this?

format of .csv file


Solution

  • This does not need to be fixed. The two species in your data set are N and NN; by default, R orders them alphabetically (N before NN), and labels the species effects according to the species. So SpeciesNN means "the difference between the baseline species (N) and species NN".