Chapter 5 Elliptical Fourier Analysis

5.1 Load packages + data

# load packages
#devtools::install_github("MomX/Momocs")
library(here)
library(Momocs)
## 
## Attaching package: 'Momocs'
## The following object is masked from 'package:ggpubr':
## 
##     mutate
## The following objects are masked from 'package:dplyr':
## 
##     arrange, combine, filter, mutate, rename,
##     sample_frac, sample_n, select, slice
## The following object is masked from 'package:tidyr':
## 
##     chop
## The following object is masked from 'package:stats':
## 
##     filter
# read images
jpg.list <- list.files(here("img.perdiz"), full.names = TRUE)

# read attribute data
att.data <- read.csv("perdiz.csv", header = TRUE, as.is = TRUE)

# attribute to factor
att.data$temporal <- as.factor(att.data$temporal)
att.data$raw.mat <- as.factor(att.data$raw.mat)
att.data$context <- as.factor(att.data$context)

knitr::kable((att.data[, 1:5]), "pipe", caption = "Qualitative data for Perdiz arrow point sample.")
(#tab:load.packages)Qualitative data for Perdiz arrow point sample.
spec trinomial context raw.mat temporal
489 41cp20 mort quartzite LC
490 41cp20 mort quartzite LC
553 41cp12 mort quartzite LC
554 41cp12 mort quartzite LC
555 41cp12 mort quartzite LC
556 41cp12 mort chert LC
558 41cp12 mort quartzite LC
559 41cp12 mort quartzite LC
562 41cp12 mort quartzite LC
565 41cp12 mort chert LC
591 41cp12 mort chert LC
598 41cp5 mort chert LC
645 41cp5 mort chert LC
646 41cp5 mort chert LC
647 41cp5 mort quartzite LC
648 41cp5 mort chert LC
649 41cp5 mort quartzite LC
650 41cp5 mort chert LC
651 41cp5 mort chert LC
652 41cp5 mort chert LC
653 41cp5 mort chert LC
654 41cp5 mort chert LC
655 41cp5 mort chert LC
656 41cp5 mort chert LC
657 41cp5 mort chert LC
658 41cp5 mort chert LC
659 41cp5 mort chert LC
660 41cp5 mort chert LC
661 41cp5 mort chert LC
665 41cp12 mort quartzite LC
677 41cp20 mort chert LC
678 41cp20 mort quartzite LC
an51-fig26a 41an51 not.mort chert MC
an51-fig26c 41an51 not.mort chert MC
an115-fig7 41an115 not.mort chert MC
cp220-fig11-12a 41cp220 not.mort chert LC
cp495-fig16h 41cp495 not.mort chert LC
cp495-fig16i 41cp495 not.mort chert LC
hc2-fig30a hcreek2 not.mort chert MC
hc2-fig30b hcreek2 not.mort quartzite MC
hc2-fig30c hcreek2 not.mort s.wd MC
hc2-fig30d hcreek2 not.mort chert MC
hc2-fig30f hcreek2 not.mort s.wd MC
hc2-fig30h hcreek2 not.mort quartzite MC
hc2-fig30i hcreek2 not.mort quartzite MC
hc2-fig30l hcreek2 not.mort quartzite MC
hc2-fig30m hcreek2 not.mort s.wd MC
hc2-fig30n hcreek2 not.mort chert MC
hs15-fig7.1r 41hs15 not.mort chert LC
hs15-fig7.1t 41hs15 not.mort chert LC
hs15-fig7.1u 41hs15 not.mort chert LC
hs15-fig7.1v 41hs15 not.mort chert LC
hs15-fig7.1w 41hs15 not.mort chert LC
hs15-fig7.1x 41hs15 not.mort chert LC
hs15-fig7.2b 41hs15 mort chert LC
hs15-fig7.2c 41hs15 mort chert LC
hs15-fig7.2d 41hs15 mort chert LC
hs15-fig7.2e 41hs15 mort chert LC
hs15-fig7.2f 41hs15 mort chert LC
hs15-fig7.2g 41hs15 mort chert LC
hs15-fig7.2m 41hs15 mort chert LC
hs15-fig7.2o 41hs15 mort chert LC
hs15-fig7.2q 41hs15 mort chert LC
hs15-fig7.2r 41hs15 mort chert LC
hs15-fig7.3a 41hs15 mort chert LC
hs15-fig7.3aa 41hs15 mort chert LC
hs15-fig7.3b 41hs15 mort chert LC
hs15-fig7.3bb 41hs15 mort chert LC
hs15-fig7.3cc 41hs15 mort chert LC
hs15-fig7.3d 41hs15 mort chert LC
hs15-fig7.3e 41hs15 mort chert LC
hs15-fig7.3f 41hs15 mort chert LC
hs15-fig7.3g 41hs15 mort chert LC
hs15-fig7.3h 41hs15 mort chert LC
hs15-fig7.3i 41hs15 mort chert LC
hs15-fig7.3j 41hs15 mort chert LC
hs15-fig7.3k 41hs15 mort chert LC
hs15-fig7.3l 41hs15 mort chert LC
hs15-fig7.3m 41hs15 mort chert LC
hs15-fig7.3n 41hs15 mort chert LC
hs15-fig7.3o 41hs15 mort chert LC
hs15-fig7.3p 41hs15 mort chert LC
hs15-fig7.3q 41hs15 mort chert LC
hs15-fig7.3r 41hs15 mort chert LC
hs15-fig7.3s 41hs15 mort chert LC
hs15-fig7.3t 41hs15 mort chert LC
hs15-fig7.3u 41hs15 mort chert LC
hs15-fig7.3w 41hs15 mort chert LC
hs15-fig7.3x 41hs15 mort chert LC
hs15-fig7.3y 41hs15 mort chert LC
hs15-fig7.3z 41hs15 mort chert LC
hs235-fig17 41hs235 mort quartzite LC
hs269-fig12j 41hs269 not.mort chert MC
na206-fig12a 41na206 not.mort s.wd HC
na206-fig12b 41na206 not.mort s.wd HC
na206-fig12d 41na206 not.mort s.wd HC
na206-fig12f 41na206 not.mort chert HC
na206-fig12g 41na206 not.mort chert HC
na49-1 41na49 mort s.wd MC
na49-10 41na49 mort s.wd MC
na49-11 41na49 mort s.wd MC
na49-12 41na49 mort s.wd MC
na49-13 41na49 mort s.wd MC
na49-137 41na49 not.mort chert MC
na49-14 41na49 mort s.wd MC
na49-149 41na49 not.mort chert MC
na49-176 41na49 not.mort chert MC
na49-187 41na49 not.mort s.wd MC
na49-195 41na49 not.mort chert MC
na49-2 41na49 mort s.wd MC
na49-271 41na49 not.mort s.wd MC
na49-3 41na49 mort s.wd MC
na49-33 41na49 not.mort chert MC
na49-4 41na49 mort s.wd MC
na49-5 41na49 mort s.wd MC
na49-587 41na49 not.mort chert MC
na49-616 41na49 not.mort s.wd MC
na49-7 41na49 mort s.wd MC
na49-734 41na49 not.mort chert MC
na49-8 41na49 mort s.wd MC
na49-9 41na49 mort s.wd MC
sa135-fig15b 41sa135 not.mort chert MC
sa135-fig15c 41sa135 not.mort chert MC
sa135-fig15g 41sa135 not.mort chert MC
sm193-fig1e 41sm193 not.mort chert MC
sm193-fig2a 41sm193 not.mort chert MC
sm193-fig2b 41sm193 not.mort chert MC
sm193-fig2e 41sm193 not.mort chert MC
sm193-fig2f 41sm193 not.mort chert MC
sm193-fig2g 41sm193 not.mort chert MC
sm195-fig8 41sm195 not.mort chert MC
sm442-fig19c 41sm442 not.mort chert MC
sm55-fig23 41sm55 not.mort chert MC
sy280-1 41sy280 not.mort s.wd LC
sy280-2 41sy280 not.mort s.wd LC
sy280-3 41sy280 not.mort s.wd LC
sy43-1 41sy43 not.mort s.wd LC
sy43-2 41sy43 not.mort s.wd LC
sy43-3 41sy43 not.mort s.wd LC
sy43-4 41sy43 not.mort s.wd LC
sy43-5 41sy43 not.mort s.wd LC
sy43-6 41sy43 not.mort s.wd LC

5.2 Generate outlines

# generate outlines
outlines <- jpg.list %>%
  import_jpg()
## Extracting 142.jpg outlines...
## [ 1 / 142 ]  489.jpg
## [ 2 / 142 ]  490.jpg
## [ 3 / 142 ]  553.jpg
## [ 4 / 142 ]  554.jpg
## [ 5 / 142 ]  555.jpg
## [ 6 / 142 ]  556.jpg
## [ 7 / 142 ]  558.jpg
## [ 8 / 142 ]  559.jpg
## [ 9 / 142 ]  562.jpg
## [ 10 / 142 ]  565.jpg
## [ 11 / 142 ]  591.jpg
## [ 12 / 142 ]  598.jpg
## [ 13 / 142 ]  645.jpg
## [ 14 / 142 ]  646.jpg
## [ 15 / 142 ]  647.jpg
## [ 16 / 142 ]  648.jpg
## [ 17 / 142 ]  649.jpg
## [ 18 / 142 ]  650.jpg
## [ 19 / 142 ]  651.jpg
## [ 20 / 142 ]  652.jpg
## [ 21 / 142 ]  653.jpg
## [ 22 / 142 ]  654.jpg
## [ 23 / 142 ]  655.jpg
## [ 24 / 142 ]  656.jpg
## [ 25 / 142 ]  657.jpg
## [ 26 / 142 ]  658.jpg
## [ 27 / 142 ]  659.jpg
## [ 28 / 142 ]  660.jpg
## [ 29 / 142 ]  661.jpg
## [ 30 / 142 ]  665.jpg
## [ 31 / 142 ]  677.jpg
## [ 32 / 142 ]  678.jpg
## [ 33 / 142 ]  an115-fig7.jpg
## [ 34 / 142 ]  an51-fig26a.jpg
## [ 35 / 142 ]  an51-fig26c.jpg
## [ 36 / 142 ]  cp220-fig11-12a.jpg
## [ 37 / 142 ]  cp495-fig16h.jpg
## [ 38 / 142 ]  cp495-fig16i.jpg
## [ 39 / 142 ]  hc2-fig30a.jpg
## [ 40 / 142 ]  hc2-fig30b.jpg
## [ 41 / 142 ]  hc2-fig30c.jpg
## [ 42 / 142 ]  hc2-fig30d.jpg
## [ 43 / 142 ]  hc2-fig30f.jpg
## [ 44 / 142 ]  hc2-fig30h.jpg
## [ 45 / 142 ]  hc2-fig30i.jpg
## [ 46 / 142 ]  hc2-fig30l.jpg
## [ 47 / 142 ]  hc2-fig30m.jpg
## [ 48 / 142 ]  hc2-fig30n.jpg
## [ 49 / 142 ]  hs15-fig7.1r.jpg
## [ 50 / 142 ]  hs15-fig7.1t.jpg
## [ 51 / 142 ]  hs15-fig7.1u.jpg
## [ 52 / 142 ]  hs15-fig7.1v.jpg
## [ 53 / 142 ]  hs15-fig7.1w.jpg
## [ 54 / 142 ]  hs15-fig7.1x.jpg
## [ 55 / 142 ]  hs15-fig7.2b.jpg
## [ 56 / 142 ]  hs15-fig7.2c.jpg
## [ 57 / 142 ]  hs15-fig7.2d.jpg
## [ 58 / 142 ]  hs15-fig7.2e.jpg
## [ 59 / 142 ]  hs15-fig7.2f.jpg
## [ 60 / 142 ]  hs15-fig7.2g.jpg
## [ 61 / 142 ]  hs15-fig7.2m.jpg
## [ 62 / 142 ]  hs15-fig7.2o.jpg
## [ 63 / 142 ]  hs15-fig7.2q.jpg
## [ 64 / 142 ]  hs15-fig7.2r.jpg
## [ 65 / 142 ]  hs15-fig7.3a.jpg
## [ 66 / 142 ]  hs15-fig7.3aa.jpg
## [ 67 / 142 ]  hs15-fig7.3b.jpg
## [ 68 / 142 ]  hs15-fig7.3bb.jpg
## [ 69 / 142 ]  hs15-fig7.3cc.jpg
## [ 70 / 142 ]  hs15-fig7.3d.jpg
## [ 71 / 142 ]  hs15-fig7.3e.jpg
## [ 72 / 142 ]  hs15-fig7.3f.jpg
## [ 73 / 142 ]  hs15-fig7.3g.jpg
## [ 74 / 142 ]  hs15-fig7.3h.jpg
## [ 75 / 142 ]  hs15-fig7.3i.jpg
## [ 76 / 142 ]  hs15-fig7.3j.jpg
## [ 77 / 142 ]  hs15-fig7.3k.jpg
## [ 78 / 142 ]  hs15-fig7.3l.jpg
## [ 79 / 142 ]  hs15-fig7.3m.jpg
## [ 80 / 142 ]  hs15-fig7.3n.jpg
## [ 81 / 142 ]  hs15-fig7.3o.jpg
## [ 82 / 142 ]  hs15-fig7.3p.jpg
## [ 83 / 142 ]  hs15-fig7.3q.jpg
## [ 84 / 142 ]  hs15-fig7.3r.jpg
## [ 85 / 142 ]  hs15-fig7.3s.jpg
## [ 86 / 142 ]  hs15-fig7.3t.jpg
## [ 87 / 142 ]  hs15-fig7.3u.jpg
## [ 88 / 142 ]  hs15-fig7.3w.jpg
## [ 89 / 142 ]  hs15-fig7.3x.jpg
## [ 90 / 142 ]  hs15-fig7.3y.jpg
## [ 91 / 142 ]  hs15-fig7.3z.jpg
## [ 92 / 142 ]  hs235-fig17.jpg
## [ 93 / 142 ]  hs269-fig12j.jpg
## [ 94 / 142 ]  na206-fig12a.jpg
## [ 95 / 142 ]  na206-fig12b.jpg
## [ 96 / 142 ]  na206-fig12d.jpg
## [ 97 / 142 ]  na206-fig12f.jpg
## [ 98 / 142 ]  na206-fig12g.jpg
## [ 99 / 142 ]  na49-1.jpg
## [ 100 / 142 ]  na49-10.jpg
## [ 101 / 142 ]  na49-11.jpg
## [ 102 / 142 ]  na49-12.jpg
## [ 103 / 142 ]  na49-13.jpg
## [ 104 / 142 ]  na49-137.jpg
## [ 105 / 142 ]  na49-14.jpg
## [ 106 / 142 ]  na49-149.jpg
## [ 107 / 142 ]  na49-176.jpg
## [ 108 / 142 ]  na49-187.jpg
## [ 109 / 142 ]  na49-195.jpg
## [ 110 / 142 ]  na49-2.jpg
## [ 111 / 142 ]  na49-271.jpg
## [ 112 / 142 ]  na49-3.jpg
## [ 113 / 142 ]  na49-33.jpg
## [ 114 / 142 ]  na49-4.jpg
## [ 115 / 142 ]  na49-5.jpg
## [ 116 / 142 ]  na49-587.jpg
## [ 117 / 142 ]  na49-616.jpg
## [ 118 / 142 ]  na49-7.jpg
## [ 119 / 142 ]  na49-734.jpg
## [ 120 / 142 ]  na49-8.jpg
## [ 121 / 142 ]  na49-9.jpg
## [ 122 / 142 ]  sa135-fig15b.jpg
## [ 123 / 142 ]  sa135-fig15c.jpg
## [ 124 / 142 ]  sa135-fig15g.jpg
## [ 125 / 142 ]  sm193-fig1e.jpg
## [ 126 / 142 ]  sm193-fig2a.jpg
## [ 127 / 142 ]  sm193-fig2b.jpg
## [ 128 / 142 ]  sm193-fig2e.jpg
## [ 129 / 142 ]  sm193-fig2f.jpg
## [ 130 / 142 ]  sm193-fig2g.jpg
## [ 131 / 142 ]  sm195-fig8.jpg
## [ 132 / 142 ]  sm442-fig19c.jpg
## [ 133 / 142 ]  sm55-fig23.jpg
## [ 134 / 142 ]  sy280-1.jpg
## [ 135 / 142 ]  sy280-2.jpg
## [ 136 / 142 ]  sy280-3.jpg
## [ 137 / 142 ]  sy43-1.jpg
## [ 138 / 142 ]  sy43-2.jpg
## [ 139 / 142 ]  sy43-3.jpg
## [ 140 / 142 ]  sy43-4.jpg
## [ 141 / 142 ]  sy43-5.jpg
## [ 142 / 142 ]  sy43-6.jpg
## Done in 19.8 secs
# add attributes
data.out <- Out(outlines, 
         fac = att.data)

# scale, align, rotate, and center specimens
norm.outlines <- data.out %>% 
  coo_scale() %>%
  coo_align() %>% 
  coo_center()

5.3 Calibrate harmonic + EFA

# calibrate how many harmonics needed
calibrate_harmonicpower_efourier(norm.outlines, 
                                 nb.h = 30)
## $gg

## 
## $q
##                        h1       h2       h3       h4       h5
## 489             72.808791 83.78198 95.17554 95.58620 96.94914
## 490             64.114719 71.74229 80.72420 89.12673 91.89527
## 553             60.227643 67.66112 78.47978 88.42469 91.97133
## 554             40.784025 62.70509 71.02441 88.80778 92.02025
## 555             71.883368 75.67063 83.98654 89.34967 91.27061
## 556             40.131674 62.71068 66.15981 84.78732 88.45546
## 558             63.012149 77.73567 90.06870 90.36598 91.90045
## 559             37.440231 60.66242 71.29934 86.72881 90.17083
## 562             60.694645 69.96634 77.12798 87.14123 90.12571
## 565             64.493270 80.33025 89.87705 90.69617 92.26710
## 591             32.410597 64.36665 71.82945 90.72323 94.12426
## 598             54.095190 69.79342 80.21895 91.62848 93.17747
## 645             37.430706 61.77266 70.12401 88.30539 92.41149
## 646             48.472059 67.04623 73.39793 90.58139 94.34818
## 647             63.962317 66.40189 73.20076 87.28925 92.34106
## 648             51.661887 60.75373 67.73491 84.11689 90.80362
## 649             13.198214 67.02359 73.20792 91.32686 96.27920
## 650             62.500557 67.69024 73.36673 89.73518 94.63252
## 651             25.861992 55.85938 68.03343 87.64255 92.73702
## 652             22.576477 60.60679 68.19757 89.37573 93.98487
## 653             53.506327 62.33004 70.77582 88.94387 93.68013
## 654             44.031205 66.31590 73.29146 91.93527 95.20683
## 655             53.169643 60.43443 64.83868 83.34328 89.55824
## 656             57.110466 63.11221 68.16400 82.60450 87.07412
## 657             44.153580 55.01196 61.02296 82.80466 87.94802
## 658             61.749011 65.60642 71.58815 87.75926 93.23432
## 659             50.938090 63.91895 68.76493 86.94809 89.69221
## 660             44.673501 62.32531 67.80680 90.92520 94.83023
## 661             48.318800 59.00113 64.26505 85.67911 90.52577
## 665             72.904144 75.33543 80.78979 88.20015 91.08371
## 677             43.622937 58.91874 66.48334 89.42983 93.54165
## 678             70.247711 71.42578 81.10140 86.84716 90.52952
## an115-fig7      52.227029 66.03736 74.39393 88.54440 91.97779
## an51-fig26a     20.037123 58.27095 69.00891 87.33896 90.87947
##                       h6       h7       h8       h9      h10
## 489             97.61501 97.95870 98.99222 99.27944 99.61408
## 490             97.25527 97.89054 98.43317 98.90168 99.21067
## 553             97.96056 98.60926 99.03073 99.36751 99.44516
## 554             97.18926 98.19496 98.35599 98.99227 99.07903
## 555             96.88514 98.02617 99.22945 99.34429 99.35722
## 556             94.74772 96.20115 97.07108 98.32436 98.35603
## 558             93.94937 94.75257 97.47642 98.23127 99.15827
## 559             96.07668 97.22067 97.71586 98.44616 98.50390
## 562             96.20471 97.29606 98.57226 99.03098 99.22437
## 565             94.75796 95.81031 98.49869 99.02328 99.61277
## 591             97.00883 98.55887 98.61906 98.76021 99.38794
## 598             97.30424 98.48432 98.73772 99.23659 99.27576
## 645             97.17813 98.23178 98.46989 98.73442 98.95378
## 646             96.89540 98.59301 98.84265 99.02189 99.39947
## 647             97.84810 98.43246 98.57160 99.16726 99.23451
## 648             96.67577 97.48979 97.90301 98.89001 98.98484
## 649             97.08839 97.94181 98.50792 98.74961 99.32895
## 650             98.08290 98.54933 98.77696 99.31998 99.46525
## 651             96.70377 98.18765 98.36471 98.70513 99.13669
## 652             96.56320 97.92897 98.12207 98.20926 99.08563
## 653             97.88528 98.55523 98.78018 99.26962 99.35380
## 654             97.46861 98.89531 98.97063 99.04404 99.48813
## 655             96.76372 97.87205 98.10188 99.14485 99.17562
## 656             95.61119 97.38995 98.24966 99.07245 99.19652
## 657             95.93126 97.01850 97.71437 98.65702 98.74675
## 658             98.24621 98.52779 98.82481 99.43320 99.46738
## 659             95.89946 97.42615 98.12618 99.17514 99.18318
## 660             96.73639 98.51319 98.64637 98.72393 99.36060
## 661             96.55592 97.60929 98.05560 98.94426 98.98235
## 665             97.41274 98.34543 99.00547 99.29183 99.36726
## 677             96.83488 98.47343 98.69266 98.80843 99.14402
## 678             96.31749 98.02421 99.25218 99.33627 99.38623
## an115-fig7      97.28538 98.37656 98.66908 99.30542 99.38414
## an51-fig26a     95.25013 97.25337 97.51169 97.69137 98.00853
##                      h11      h12      h13      h14      h15
## 489             99.66292 99.67257 99.74548 99.77200 99.80462
## 490             99.26009 99.39885 99.47944 99.54422 99.59587
## 553             99.53735 99.61913 99.67585 99.71820 99.75627
## 554             99.18155 99.65220 99.70881 99.74345 99.82060
## 555             99.65024 99.70336 99.74050 99.84641 99.86700
## 556             98.48074 98.91994 99.09404 99.22256 99.33403
## 558             99.24117 99.41253 99.50428 99.56908 99.72318
## 559             98.65258 99.15941 99.41700 99.61239 99.65349
## 562             99.49559 99.52488 99.55208 99.75261 99.77378
## 565             99.62274 99.65681 99.75540 99.77200 99.81405
## 591             99.56447 99.69590 99.74709 99.77566 99.78641
## 598             99.30295 99.50219 99.52999 99.55235 99.69048
## 645             99.08073 99.40631 99.44517 99.47290 99.55845
## 646             99.48570 99.57729 99.68552 99.70816 99.72993
## 647             99.33657 99.54623 99.61790 99.66645 99.73749
## 648             99.05226 99.30660 99.42561 99.52725 99.64522
## 649             99.45088 99.48496 99.54428 99.68207 99.72057
## 650             99.56771 99.71114 99.72319 99.74218 99.76137
## 651             99.30682 99.42507 99.45162 99.50142 99.52530
## 652             99.26329 99.35190 99.43444 99.46619 99.51808
## 653             99.44214 99.64394 99.65243 99.71399 99.78507
## 654             99.58569 99.67358 99.74212 99.75227 99.76880
## 655             99.18710 99.55622 99.62697 99.74582 99.74946
## 656             99.44583 99.52592 99.55966 99.75749 99.77316
## 657             98.81958 99.36470 99.57875 99.72769 99.75758
## 658             99.50607 99.77579 99.82474 99.84460 99.85641
## 659             99.26235 99.62159 99.66360 99.70855 99.81597
## 660             99.56113 99.71252 99.74223 99.74241 99.75423
## 661             99.00026 99.45111 99.52906 99.58658 99.67788
## 665             99.57786 99.63159 99.67359 99.78074 99.78648
## 677             99.27266 99.54711 99.57613 99.60539 99.62761
## 678             99.56052 99.60291 99.61013 99.70996 99.78256
## an115-fig7      99.42461 99.61270 99.62449 99.62990 99.65750
## an51-fig26a     98.43021 98.56876 98.89093 99.10015 99.37975
##                      h16      h17      h18      h19      h20
## 489             99.82192 99.82341 99.85272 99.87865 99.91085
## 490             99.62522 99.63711 99.71079 99.75015 99.75947
## 553             99.77140 99.78933 99.81395 99.83675 99.88522
## 554             99.82265 99.84003 99.88827 99.89508 99.90968
## 555             99.89300 99.92314 99.94175 99.96739 99.96955
## 556             99.42302 99.55630 99.59933 99.63249 99.66365
## 558             99.74806 99.78242 99.84868 99.86327 99.88367
## 559             99.69833 99.74681 99.79044 99.80719 99.82695
## 562             99.82801 99.85958 99.86190 99.88385 99.89866
## 565             99.84130 99.86763 99.88482 99.92366 99.94140
## 591             99.87133 99.87713 99.88817 99.92076 99.92919
## 598             99.74154 99.75481 99.81876 99.87467 99.87899
## 645             99.56258 99.59820 99.71182 99.76571 99.83101
## 646             99.80558 99.82420 99.83787 99.86296 99.89529
## 647             99.75055 99.76713 99.77742 99.84435 99.86703
## 648             99.65408 99.70820 99.73725 99.76721 99.84772
## 649             99.77413 99.79398 99.81656 99.84928 99.87351
## 650             99.77677 99.79153 99.81017 99.88066 99.88864
## 651             99.60766 99.64903 99.71442 99.72953 99.80386
## 652             99.67351 99.77700 99.78891 99.84286 99.85576
## 653             99.82541 99.84104 99.87795 99.89456 99.89757
## 654             99.82519 99.84526 99.85335 99.87885 99.89331
## 655             99.76780 99.77633 99.81093 99.85482 99.87491
## 656             99.80910 99.81796 99.84004 99.84539 99.89515
## 657             99.77069 99.78894 99.81597 99.84526 99.85987
## 658             99.86427 99.86832 99.91702 99.93080 99.94344
## 659             99.83027 99.84733 99.86700 99.87883 99.88528
## 660             99.80213 99.82431 99.83041 99.85408 99.87850
## 661             99.69162 99.70964 99.76618 99.81364 99.85320
## 665             99.80747 99.84066 99.85990 99.86897 99.90740
## 677             99.71459 99.77934 99.78599 99.82397 99.84851
## 678             99.78790 99.85325 99.87332 99.89596 99.90323
## an115-fig7      99.66926 99.67207 99.72294 99.75347 99.78824
## an51-fig26a     99.45431 99.66639 99.75295 99.78979 99.81799
##                      h21      h22      h23      h24      h25
## 489             99.92286 99.94669 99.96596 99.98339 99.98504
## 490             99.78940 99.82367 99.86219 99.92748 99.93455
## 553             99.89000 99.92227 99.92644 99.93262 99.94819
## 554             99.92937 99.94159 99.94846 99.96047 99.97359
## 555             99.97635 99.97732 99.98256 99.98329 99.99026
## 556             99.69817 99.72227 99.73924 99.75857 99.78090
## 558             99.90459 99.90700 99.92415 99.93280 99.97915
## 559             99.87185 99.89070 99.93852 99.94821 99.96116
## 562             99.90624 99.93707 99.94290 99.95298 99.95893
## 565             99.95881 99.96587 99.98508 99.98571 99.98634
## 591             99.94188 99.95569 99.96000 99.96944 99.97262
## 598             99.89069 99.90750 99.93148 99.94348 99.97319
## 645             99.88606 99.91024 99.91251 99.92711 99.93754
## 646             99.89981 99.94561 99.94999 99.95108 99.96046
## 647             99.88193 99.92977 99.95002 99.95551 99.97231
## 648             99.86568 99.89290 99.92611 99.92919 99.94981
## 649             99.88844 99.90363 99.90763 99.93084 99.94448
## 650             99.92889 99.95128 99.95697 99.95804 99.97550
## 651             99.82414 99.83815 99.86617 99.91585 99.92272
## 652             99.90064 99.93449 99.93964 99.94659 99.96045
## 653             99.90810 99.92429 99.94213 99.94952 99.96145
## 654             99.91234 99.93124 99.94158 99.94476 99.95093
## 655             99.91767 99.92153 99.93546 99.95328 99.96402
## 656             99.90107 99.90748 99.93264 99.93569 99.95801
## 657             99.87213 99.90453 99.93306 99.95702 99.97221
## 658             99.95814 99.95937 99.96680 99.97460 99.98321
## 659             99.90467 99.91397 99.94898 99.95854 99.96858
## 660             99.89197 99.91011 99.92247 99.94037 99.95445
## 661             99.88166 99.88563 99.89367 99.91834 99.93786
## 665             99.90987 99.92833 99.94610 99.95185 99.96528
## 677             99.87206 99.93771 99.93980 99.94562 99.95115
## 678             99.92267 99.93005 99.94635 99.95250 99.96118
## an115-fig7      99.82672 99.85442 99.89998 99.95409 99.96209
## an51-fig26a     99.83093 99.84700 99.86316 99.89490 99.93231
##                      h26      h27      h28 h29
## 489             99.99251 99.99371 99.99574 100
## 490             99.96848 99.98226 99.99078 100
## 553             99.97288 99.98151 99.98828 100
## 554             99.97812 99.98289 99.98863 100
## 555             99.99125 99.99440 99.99454 100
## 556             99.83743 99.87875 99.97544 100
## 558             99.98029 99.98517 99.99161 100
## 559             99.97516 99.98627 99.99001 100
## 562             99.97706 99.97944 99.99213 100
## 565             99.99102 99.99496 99.99815 100
## 591             99.98283 99.98986 99.99933 100
## 598             99.97965 99.99165 99.99538 100
## 645             99.94735 99.96603 99.96636 100
## 646             99.96673 99.97721 99.98563 100
## 647             99.97771 99.97981 99.99703 100
## 648             99.96239 99.98568 99.99734 100
## 649             99.96397 99.97705 99.98854 100
## 650             99.97808 99.98663 99.99276 100
## 651             99.96878 99.97907 99.98814 100
## 652             99.96570 99.97796 99.97914 100
## 653             99.96616 99.97349 99.98101 100
## 654             99.97372 99.98650 99.99498 100
## 655             99.97827 99.98215 99.98870 100
## 656             99.96491 99.98486 99.99717 100
## 657             99.97408 99.99000 99.99282 100
## 658             99.98500 99.99520 99.99921 100
## 659             99.97314 99.98438 99.99169 100
## 660             99.97124 99.97581 99.98600 100
## 661             99.95715 99.98864 99.99733 100
## 665             99.97796 99.98729 99.99499 100
## 677             99.96424 99.97163 99.99565 100
## 678             99.96790 99.97532 99.98628 100
## an115-fig7      99.96910 99.97535 99.99002 100
## an51-fig26a     99.96307 99.96865 99.99647 100
##  [ reached getOption("max.print") -- omitted 108 rows ]
## 
## $minh
##   90%   95%   99% 99.9% 
##     6     7    11    23
# 11 harmonics needed to capture 99 percent of variation
calibrate_reconstructions_efourier(norm.outlines, 
                                   range = 1:11)

# generate efa outlines with 11 harmonics
efa.outlines <- efourier(norm.outlines, 
                         nb.h = 11, 
                         norm = TRUE)

# use efa.outlines for pca
pca.outlines <- PCA(efa.outlines)

5.4 PCA

# pca 
scree_plot(pca.outlines)

# plot pca by temporal
plot(pca.outlines,
     pos.shp = "range_axes",
     ~temporal,
     chull = TRUE,
     morphospace = TRUE,
     labelsgroups = TRUE,
     cex.labelsgroups = 0.5,
     rect.labelsgroups = TRUE,
     rug = TRUE,
     grid = TRUE,
     zoom = 0.95)
## will be deprecated soon, see ?plot_PCA

# plot pca by raw material
plot(pca.outlines,
     pos.shp = "range_axes",
     ~raw.mat,
     chull = TRUE,
     morphospace = TRUE,
     labelsgroups = TRUE,
     cex.labelsgroups = 0.5,
     rect.labelsgroups = TRUE,
     rug = TRUE,
     grid = TRUE,
     zoom = 0.95)
## will be deprecated soon, see ?plot_PCA

# plot pca by context
plot(pca.outlines,
     pos.shp = "range_axes",
     ~context,
     chull = TRUE,
     morphospace = TRUE,
     labelsgroups = TRUE,
     cex.labelsgroups = 0.5,
     rect.labelsgroups = TRUE,
     rug = TRUE,
     grid = TRUE,
     zoom = 0.95)
## will be deprecated soon, see ?plot_PCA

# mean shape + 2sd for the first 10 pcs
PCcontrib(pca.outlines, nax = 1:5)

5.5 MANOVA + MANOVA_PW

# manova

# shape difference by temporal?
MANOVA(pca.outlines, 'temporal')
## PC axes 1 to 18 were retained
##            Df Hotelling-Lawley approx F num Df den Df    Pr(>F)
## fac         2           1.8209   6.1202     36    242 < 2.2e-16
## Residuals 139                                                  
##              
## fac       ***
## Residuals    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# which differ?
MANOVA_PW(pca.outlines, 'temporal')
## 'HC' has 5 rows, and 'retain' is set accordingly
## PC axes 1 to 5 were retained
## HCLC
## HCMC
## LCMC
## $stars.tab
##    HC LC  MC 
## HC    *** ***
## LC        ***
## 
## $summary (see also $manovas)
##         Df Pillai approx F num Df den Df    Pr(>F)
## HC - LC  1 0.3343    8.737      5     87 9.561e-07
## HC - MC  1 0.7120   23.739      5     48 6.203e-12
## LC - MC  1 0.3237   12.538      5    131 5.950e-10
# shape difference between raw.mat?
MANOVA(pca.outlines, 'raw.mat')
## PC axes 1 to 18 were retained
##            Df Hotelling-Lawley approx F num Df den Df    Pr(>F)
## fac         2          0.77286   2.5977     36    242 9.226e-06
## Residuals 139                                                  
##              
## fac       ***
## Residuals    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# which differ?
MANOVA_PW(pca.outlines, 'raw.mat')
## 'quartzite' has 17 rows, and 'retain' is set accordingly
## PC axes 1 to 17 were retained
## chertquartzite
## cherts.wd
## quartzites.wd
## $stars.tab
##           chert quartzite s.wd
## chert           **        *** 
## quartzite                 *   
## 
## $summary (see also $manovas)
##                   Df Pillai approx F num Df den Df    Pr(>F)
## chert - quartzite  1 0.2997    2.341     17     93 0.0050567
## chert - s.wd       1 0.3057    2.771     17    107 0.0007521
## quartzite - s.wd   1 0.5650    2.292     17     30 0.0228460
# shape difference by context?
MANOVA(pca.outlines, 'context')
## PC axes 1 to 18 were retained
##            Df Hotelling-Lawley approx F num Df den Df   Pr(>F)
## fac         1           0.6106   4.1724     18    123 8.86e-07
## Residuals 140                                                 
##              
## fac       ***
## Residuals    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

5.6 Mean shapes

# mean shapes

# temporal
ms.1 <- MSHAPES(efa.outlines, ~temporal)
plot_MSHAPES(ms.1, size = 0.75)

# raw material
ms.2 <- MSHAPES(efa.outlines, ~raw.mat)
plot_MSHAPES(ms.2, size = 0.75)

# context
ms.3 <- MSHAPES(efa.outlines, ~context)
plot_MSHAPES(ms.3, size = 0.75)