brandmaier/semtree

toTable appears to issue an error when applied to tree with multiple covariates

Closed this issue · 2 comments

#See code below that recreates the issue.
library(psychTools)
data(affect)

affect$Film <- factor(affect$Film, ordered = FALSE,
labels=c("Frontline", "Halloween", "Nat. Geographic","Parenthood"))

tree.data <- affect[,c("Film","neur","ext","soc","traitanx","NA1","PA1")]
tree.data$DeltaPA <- affect$PA2-affect$PA1

knitr::kable(head(tree.data))

library(OpenMx)
manifests<-c("DeltaPA")
latents<-c()
model <- mxModel("Simple Model",
type="RAM",
manifestVars = manifests,
latentVars = latents,
mxPath(from="one",to=manifests, free=c(TRUE), value=c(1.0) , arrows=1, label=c("mu") ),
mxPath(from=manifests,to=manifests, free=c(TRUE), value=c(1.0) , arrows=2, label=c("sigma2") ),
mxData(tree.data, type = "raw")
);

result <- mxRun(model)

library(semtree)
ctrl = semtree.control(
method="score",
bonferroni = TRUE)
tree = semtree( model = result,
data = tree.data,
control=ctrl)

toTable(tree,round.param=12)

Thanks for reporting this bug. In fact, it is caused by the score test, not by the multiple covariates. Will fix this asap.

Bug is fixed now: 5243f4c. Please install altest version from this repository. Thanks, again, @knimon1 !