Dear Bryan,
you are correct. However, my issue is getting a model with an interaction to run. I only get errors. I have no idea what I am doing wrong. Could you help?
Here is my code:
Datapre <- readland.tps("pre.tps", specID = c("ID"), negNA = FALSE, warnmsg = TRUE)
Datapost <- readland.tps("post.tps", specID = c("ID"), negNA = FALSE, warnmsg = TRUE)
shape.pre <- gpagen(Datapre)$coords
shape.post <- gpagen(Datapost)$coords
pre.dat <- two.d.array(shape.pre)
post.dat <- two.d.array(
shape.post)
add <- read.table("add.txt", header=TRUE, stringsAsFactors=TRUE, sep="\t", na.strings="NA", dec=".", strip.white=TRUE)
dat.full <- geomorph.data.frame(coordspre = pre.dat, coordspost = post.dat, treatment = add$Treatment)
str(dat.full)
List of 3
$ coordspre : num [1:21, 1:26] 0.408 0.402 0.397 0.407 0.402 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:21] "0 " "1 " "2 " "3 " ...
.. ..$ : chr [1:26] "1.X" "1.Y" "2.X" "2.Y" ...
$ coordspost: num [1:21, 1:26] 0.397 0.399 0.404 0.407 0.394 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:21] "0 " "1 " "2 " "3 " ...
.. ..$ : chr [1:26] "1.X" "1.Y" "2.X" "2.Y" ...
$ treatment : Factor w/ 2 levels "A","B": 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, "class")= chr "geomorph.data.frame"
m.1<-procD.lm(dat.full$coordspost~dat.full$coordspre*dat.full$treatment,iter=999)
ERROR: 'names' attribute [3] must be the same length as the vector [1]
m.pgls <- procD.pgls(coordspost ~ coordspre*treatment, data = dat.full, iter = 999)
ERROR: argument "phy" is missing, with no default
m.2<-lm.rrpp(coordspost ~ coordspre*treatment, SS.type = "III", data=dat.full, iter=999)
ERROR: One or more independent variables does not match the number of observations in the data.
The only thing that works is a PLS without treatment, which is why I was looking for a way to incorporate treatment here:
two.b.pls(dat.full$coordspost, dat.full$coordspre, iter = 999, seed = NULL, print.progress = TRUE)
r-PLS: 0.756
Effect Size (Z): 1.3503
P-value: 0.089
Based on 1000 random permutations
Tyler