classify_mature: Classify mature

Description Usage Arguments Details Value Examples

View source: R/morphMat-main.R

Description

Classify the individuals in two groups (0: juveniles, 1: adults) based on relative growth.

Usage

1
2
classify_mature(data, varNames = c("x", "y"), varSex = "sex",
  selectSex = NULL, method = "ld")

Arguments

data

data.frame with allometric variables and sex category (male, female). If sex category contains NA's, that row will be filtered.

varNames

the name of two allometric variables to be used for analysis.

varSex

the name of the variable containing sex information.

selectSex

sex category to be used for analysis. If selectSex = NULL all the individuals will be used in the analysis.

method

a character string indicating the discriminant analysis method, linear discriminant analysis "ld", quadratic discriminant analysis "qd". We suggest begin the analysis using the method = "ld".

Details

Classify the individuals in two groups (juveniles = 0 and adult = 1).

A Principal Components Analisys was conducted with two allometric variables (x: independent variable, y: dependent variable) in log base, allowing to distinguish two groups that would represent juveniles and adult. The individuals are assigned to each group using a hierarchical classification procedure (hierarchical cluster with agglomeration method: "Ward.D" and the distance measure: "euclidean"). This method is based on establishing a predetermined number of groups (in this case, two) and assigning individuals to one of the groups according to their loads on the two axes of the PCA (Corgos & Freire, 2006).

Using the results of the classification (PCA + cluster), a discriminant analysis (linear or quadratic) is conducted to obtain a discriminating function that permitted any individuals to be classified as a juvenile or an adult on the basis of the X and Y allometric variables.

Value

A data.frame of class 'classify', with x (independent), y (dependent) and classification of maturity (juveniles = 0, adult = 1) variables.

Examples

1
2
3
4
5
6
data(crabdata)

classify_data = classify_mature(crabdata, varNames = c("carapace_width", "chela_heigth"),
varSex = "sex_category", selectSex = NULL, method = "ld")

classify_data

Example output

all individuals were used in the analysis 

Number in juveline group = 83 

Number in adult group = 140 

-------------------------------------------------------- 
1) Linear regression for juveniles 

Call:
glm(formula = y ~ x, data = juv)

Deviance Residuals: 
     Min        1Q    Median        3Q       Max  
-2.77010  -0.57399   0.09397   0.56605   1.99008  

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) -3.794687   0.497056  -7.634 3.93e-11 ***
x            0.161327   0.004701  34.314  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 0.7320842)

    Null deviance: 921.306  on 82  degrees of freedom
Residual deviance:  59.299  on 81  degrees of freedom
AIC: 213.63

Number of Fisher Scoring iterations: 2

-------------------------------------------------------- 
2) Linear regression for adults 

Call:
glm(formula = y ~ x, data = adt)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-3.3055  -1.0932  -0.0628   1.1178   3.2759  

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -11.246726   1.199496  -9.376   <2e-16 ***
x             0.273837   0.008648  31.663   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 2.265729)

    Null deviance: 2584.24  on 139  degrees of freedom
Residual deviance:  312.67  on 138  degrees of freedom
AIC: 515.79

Number of Fisher Scoring iterations: 2

-------------------------------------------------------- 
3) Difference between slopes (ANCOVA) 
              Estimate  Std. Error   t value     Pr(>|t|)
(Intercept) -3.7946869 0.757105677 -5.012097 1.109526e-06
x            0.1613275 0.007161179 22.528064 6.035478e-59
mature      -7.4520389 1.285219562 -5.798261 2.320729e-08
x:mature     0.1125093 0.010361046 10.858878 2.956242e-22
[1] "slopes are different"

sizeMat documentation built on Aug. 1, 2019, 1:05 a.m.