 Dear list, 

I am relatively new to R and GLM"S so please bear with me!


I am trying to plot a graph of my binary response (threat) on the Y axis and the variable SEA on the X-

I have used the following code but the graph looks odd ( https://files.me.com/chrismcowen/xz47o4) i presume it is because i have categorical factors and R is plotting a box and whisker plot of the binary response? It has been suggested i look at the  interaction plots on the predicted values, however i am unsure how to do this?


The SEA variable is categorical 1 - 4  

mydata <- data.frame(SEA)
Pred <- predict(model1, newdata = mydata, type = "response"),
plot(x = traits$SEA, y = traits$threat), 
lines(mydata$SEA, Pred)

I also want to use the model to predict results - if i know a species is annual, is pollinated by insects and has unisexual flowers - for example - how do i predict the response, in this case threatened or not. 

I was thinking i would need to calculate the log odds using the coefficients from the GLM for each factor convert them into a probability, then calculate the probability for the entire model and then,  using this value,  predict if a species is threatened or not. However i am not sure if this is the best way or if i am being longwinded?

Furthermore, i am next going to convert threat or not into a continuos response and develop a  ordinal model, with varying degrees of threat (1-6) i presume the aforementioned  approach is applicable under this scenario as well?

Chris

model1 <- glm(THREAT~HAB*FR+BS+SEA+PD+WO)

coef(model1)
                (Intercept)                HABLithophyte 
                -0.11880089                   0.10498055 
            HABSemi-aquatic               HABTerrestrial 
                 0.36712439                   0.17641700 
               FRNon_fleshy          BSUnisexual_flowers 
                 0.35551197                  -0.00706299 
          BSUnisexual_plant               SEAHapaxanthic 
                 0.06857112                  -0.53281439 
               SEAPerrenial               SEAPleonanthic 
                 0.18798090                  -0.08547676 
                   PDBiotic                      WOWoody 
                 0.29155388                   0.12533079 
 HABLithophyte:FRNon_fleshy HABSemi-aquatic:FRNon_fleshy 
                 0.27595822                  -0.31031510 
HABTerrestrial:FRNon_fleshy 
                -0.31065039 



'data.frame':	1115 obs. of  20 variables:
$ order     : Factor w/ 9 levels "Alismatales",..: 7 3 3 8 8 8 8 8 8 8 ...
$ fam       : Factor w/ 42 levels "Agavaceae","Alliaceae",..: 40 34 34 36 11 11 11 11 11 36 ...
$ genus     : Factor w/ 449 levels "Acanthochlamys",..: 1 2 2 3 4 4 4 4 4 5 ...
$ species   : Factor w/ 1065 levels "abdulrahmanii",..: 123 429 851 1065 156 243 485 735 761 107 ...
$ Tip       : Factor w/ 1115 levels "Acanthochlamys_bracteata",..: 1 2 3 4 5 6 7 8 9 10 ...
$ HAB       : Factor w/ 4 levels "Epiphyte","Lithophyte",..: 4 1 1 4 1 1 1 1 1 4 ...
$ STO       : Factor w/ 2 levels "No_Storage_organ",..: 2 2 1 2 1 1 1 1 1 2 ...
$ BS        : Factor w/ 3 levels "Bisexual_flower",..: 1 1 1 3 1 1 1 1 1 1 ...
$ PD        : Factor w/ 2 levels "Abiotic","Biotic": 2 2 2 1 2 2 2 2 2 1 ...
$ FR        : Factor w/ 2 levels "Fleshy","Non_fleshy": 1 2 2 2 1 1 1 1 1 2 ...
$ END       : Factor w/ 2 levels "Endosperm","No_endosperm": 1 2 2 1 1 1 1 1 1 1 ...
$ WO        : Factor w/ 2 levels "Non_woody","Woody": 1 1 1 1 1 1 1 1 1 1 ...
$ RG        : Factor w/ 2 levels "One","Two+": 1 1 1 2 1 1 1 1 1 2 ...
$ SEA       : Factor w/ 4 levels "Annual","Hapaxanthic",..: 3 3 3 3 3 3 3 3 3 1 ...
$ SE        : Factor w/ 3 levels "Few","Numerous",..: 2 2 2 3 2 2 2 2 2 3 ...
$ FS        : Factor w/ 2 levels "Actinomorphic",..: 1 2 2 1 1 1 1 1 1 2 ...
$ IUCN      : Factor w/ 6 levels "CR","EN","LC",..: 4 5 6 3 5 1 5 6 4 3 ...
$ EXTINCTION: int  6 2 3 1 2 5 2 3 6 1 ...
$ THREAT    : int  1 0 1 0 0 1 0 1 1 0 ...
$ THREATtf  : logi  TRUE FALSE TRUE FALSE FALSE TRUE ...



	[[alternative HTML version deleted]]

