Closed Hanqingpeng closed 3 years ago
Hi, Thank you for reporting this. Could you please give a minimal example of the covariates you used and the models you tested, so that I can look into the error more precisely ? Thank you very much.
I am also encountered this error when I run the code in "README.md" in the EMtree files.
library(ade4) library(tidyverse) data(baran95) counts = as.matrix(baran95$fau) covar = as_tibble(baran95$plan)
n = nrow(counts) p = ncol(counts)
head(counts)
head(covar)
#
PLNmodels
objectlibrary(PLNmodels) model<-PLN(counts ~ covar$site) library(EMtree) set.seed(3) output<-EMtree(model, maxIter = 10, plot=TRUE) str(output) library(parallel) resample_output<-ResampleEMtree(counts=counts, covar_matrix = covar$site , S=5, maxIter=10,cond.tol=1e-8, cores=1) str(resample_output) library(parallel) tested_models=list("date","site",c("date","site")) models_names=c("date","site","date + site") compare_output<-ComparEMtree(counts, covar_matrix=covar, models=tested_models, m_names=models_names, Pt=0.15, S=3, maxIter=5,cond.tol=1e-8,cores=1)
compare_output<-ComparEMtree(counts, covar_matrix=covar, models=tested_models, m_names=models_names, Pt=0.15, S=3, maxIter=5,cond.tol=1e-8,cores=1)
model dateError in terms.formula(object, data = data) : ExtractVars里的模型公式不对
No error when modify the code as follow.
tested_models=list(1,2,c(1,2)) models_names=c("date","site","date + site") compare_models<-ComparEMtree(Y, X, models=tested_models, m_names=models_names, Pt=2/p, S=3, maxIter=5,cond.tol=1e-8,cores=1)
compare_output<-ComparEMtree(counts, covar_matrix=covar, models=tested_models, m_names=models_names, Pt=0.15, S=3, maxIter=5,cond.tol=1e-8,cores=1)
model dateError in terms.formula(object, data = data) : ExtractVars里的模型公式不对
No error when modify the code as follow.
tested_models=list(1,2,c(1,2)) models_names=c("date","site","date + site") compare_models<-ComparEMtree(Y, X, models=tested_models, m_names=models_names, Pt=2/p, S=3, maxIter=5,cond.tol=1e-8,cores=1)
Hi @vincentwb,
Thank you for reporting this. I think the README.md you refer to is not up to date, I suggest you update your version of EMtree by downloading it again. This example of the ComparEMtree() function is now in the Fatala.Rmd vignette, and actually specifies the tested_models parameter exactly like you did in your last comment. I am interested in knowing if this function is useful to you ? I was thinking about deleting it.
compare_output<-ComparEMtree(counts, covar_matrix=covar, models=tested_models, m_names=models_names, Pt=0.15, S=3, maxIter=5,cond.tol=1e-8,cores=1)
model dateError in terms.formula(object, data = data) : ExtractVars里的模型公式不对