Function uses stepwise LDA to choose best predictors for group membership, and then "regular" LDA to predict discriminant scores.

calc_ds(data, group_info)

Arguments

data

Matrix or data frame containing PC scores of specimen (rows = specimen, cols = PCs). Can also contain an additional column that defines group membership

group_info

Numeric index of column in data that indicates actual group membership, or a dataframe with two columns (col 1 = id matching the rownames in data; col 2 = group)

Value

Returns tibble with columns "id" and "DS". If data contained rownames, these will be saved as ids

Details

First uses greedy.wilks to perform stepwise forward variable selection for classification, then uses selected variables in lda

Examples

data(LondonSet_scores) group_info <- LondonSet_info %>% dplyr::select(face_id, face_sex) calc_ds(data = LondonSet_scores, group_info = group_info)
#> # A tibble: 102 x 2 #> id DS #> <chr> <dbl> #> 1 001 -3.28 #> 2 002 -1.85 #> 3 003 -1.92 #> 4 004 0.214 #> 5 005 0.134 #> 6 006 -1.76 #> 7 007 -2.80 #> 8 008 2.24 #> 9 009 -2.53 #> 10 010 -0.903 #> # … with 92 more rows