Skip to content

Commit

Permalink
fixed linear interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
freezenik committed Dec 2, 2024
1 parent 36ae1ac commit f0c2926
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions R/gamlss2.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,21 @@ gamlss2.formula <- function(formula, data, family = NO,
Xterms[[i]] <- c(Xterms[[i]], colnames(X)[ij])
}
}
## Interactions.
if(grepl(":", j, fixed = TRUE)) {
xl <- strsplit(j, ":", fixed = TRUE)[[1]][2]
xl <- paste0(":", xl)
xl <- grep(xl, colnames(X), fixed = TRUE, value = TRUE)
Xterms[[i]] <- unique(c(Xterms[[i]], xl))
}
}
}

## Drop.
for(i in names(Xterms)) {
Xterms[[i]] <- Xterms[[i]][Xterms[[i]] %in% colnames(X)]
}

attr(Xterms, "xlevels") <- xlev

## Optionally, use optimizer function provided from family
Expand Down

0 comments on commit f0c2926

Please sign in to comment.