I'm getting an error while working with a deletion/substitution/addition(DSA) algorithm on my data.
The package I'm using is: DSA
The error is:
Error in get.forced.terms(formula, data, Xlearn, expand.forced.term.factors) :
WARNING: Incorrect formula for forcedterms.
I ran it step by step and the error is in the last line (mod = mclapply...)
Thanks for the help!
Here is my code:
dsa_algorithm = function(data.long,outcome,expo,covar,CV,n.cores){
confounders = paste(covar,collapse=" + ")
data = data.long[!is.na(data.long[,outcome]),c("ID",outcome,expo,covar)]
form = paste(outcome,"~",confounders) %>% formula
mod = mclapply(1:CV,
function(x) DSA(form,
data=data,
maxsize=50,
maxorderint=1,
maxsumofpow=1,
id=data$ID,),
mc.cores = n.cores)
I checked data, variables and everything seems to be in order.