1

The model output coefficients list only two out of the three discrete values. What am I doing wrong?

> mammaldata<-read.table("C:/Users/Cheryl/Google Drive/Uni/Life706 - Project/Data//Data 2.txt",sep = "\t",header = TRUE)
> View(mammaldata)
> str(mammaldata)
'data.frame':   54 obs. of  11 variables:
 $ Order                : Factor w/ 11 levels "Artiodactyla",..: 1 11 11 1 1 11 11 11 6 11 ...
 $ Family               : Factor w/ 31 levels "Antilocapridae",..: 1 20 20 2 3 4 7 20 29 28 ...
 $ Species              : Factor w/ 54 levels "Antilocapra_americana",..: 1 2 3 4 5 6 7 8 9 10 ...
 $ P50                  : num  28.3 33.5 38.4 28.7 25.9 29 26.8 33.2 36.9 22 ...
 $ BMR                  : num  5.62 36.4 23.28 3.18 1.99 ...
 $ Adult_Body_Mass_g    : num  47450 21.9 120 618642.4 492714.5 ...
 $ Gestation_Period_days: num  248 23.7 21.2 280.5 386.5 ...
 $ Litter_Size          : num  1.93 5.16 4.76 1 0.98 3.45 2.5 4.31 4.04 4.43 ...
 $ Litters_per_Year     : num  1 3.75 3.5 1 1 5 2.5 3.5 3.5 1 ...
 $ Max._Longevity_years : num  15.5 6.3 2.5 20 28.4 12 10 4.9 4 11 ...
$ Placenta_Type        : Factor w/ 3 levels "Endotheliochorial",..: 2 3 3 2 2 3 3 3 3 3 ...
> names(mammaldata)
 [1] "Order"                 "Family"                "Species"              
 [4] "P50"                   "BMR"                   "Adult_Body_Mass_g"    
 [7] "Gestation_Period_days" "Litter_Size"           "Litters_per_Year"     
[10] "Max._Longevity_years"  "Placenta_Type"        
> mammaltree<-read.nexus("C:/Users/Cheryl/Google Drive/Uni/Life706 - Project/Data/1 tree.nex")
> mammaldata$dropped$unmatched.rows
NULL
> mammals$dropped$unmatched.rows
character(0)
> mammaltree

Phylogenetic tree with 4510 tips and 2108 internal nodes.

Tip labels:
Tachyglossus_aculeatus, Zaglossus_bruijni, Ornithorhynchus_anatinus, Anomalurus_beecrofti, Anomalurus_derbianus, Anomalurus_pelii, ...
Node labels:
'1', '2_Monotremata', '3_Tachyglossidae', '4', '5_Eutheria', '6', ...

Rooted; includes branch lengths.

> mod2<-pgls(log(P50)~ log(Gestation_Period_days)+Placenta_Type,data = mammals, lambda = "ML")
> summary(mod2)

Call:
pgls(formula = log(P50) ~ log(Gestation_Period_days) + Placenta_Type, 
data = mammals, lambda = "ML")

Residuals:
 Min       1Q   Median       3Q      Max 
-0.03301 -0.01658 -0.00183  0.01022  0.03765 

Branch length transformations:

kappa  [Fix]  : 1.000
lambda [ ML]  : 0.746
lower bound : 0.000, p = 0.001461
upper bound : 1.000, p = 0.00073547
95.0% CI   : (0.295, 0.944)
delta  [Fix]  : 1.000

Coefficients:
                           Estimate Std. Error t value  Pr(>|t|)    
(Intercept)                    4.425391   0.239126 18.5065 < 2.2e-16 ***
log(Gestation_Period_days)    -0.171626   0.042427 -4.0452  0.000181 ***
Placenta_TypeEpitheliochorial -0.148696   0.116891 -1.2721  0.209228    
Placenta_TypeHemochorial      -0.291269   0.105203 -2.7686  0.007875 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.01904 on 50 degrees of freedom
Multiple R-squared: 0.2788, Adjusted R-squared: 0.2356 
F-statistic: 6.444 on 3 and 50 DF,  p-value: 0.0008945 

I've included as much of the code as I thought may be informative. Any help would be greatly appreciated.

Steffen Moritz
  • 1,564
  • 2
  • 15
  • 22
Kel
  • 11
  • 1
  • 1
    The other level is the reference category. Try searching this site for "reference category" or re-read the relevant section in your textbook. In short, there is nothing wrong here, it is what is expected. – mdewey Aug 09 '17 at 12:42
  • See my answer [here](https://stats.stackexchange.com/questions/146351/regression-with-categorical-predictors-use-only-some-dummy-variables/146352#146352) which should be helpful – kjetil b halvorsen Mar 17 '19 at 10:48

1 Answers1

1

it is a general issue about dummy variables. One of the levels is the reference level, that is, when Epitheliochorial and Hemochorial are 0, you get the values for the third level. My advice to you is that you read the basics of linear regression.

Hope this helps Cheers