Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1.10 #50

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: enmSdmX
Type: Package
Title: Species Distribution Modeling and Ecological Niche Modeling
Version: 1.1.9
Date: 2024-11-01
Version: 1.1.10
Date: 2024-11-06
Authors@R:
c(
person(
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# enmSdmX 1.1.10 2024-11-06
- `trainNS()` works when the number of predictors is >2 and interactions are allowed between variables (thank you again, Pascal!).

# enmSdmX 1.1.9 2024-11-01
- `trainGAM()` does not include interaction terms if `interaction` is `NULL`, and does not fail when interactions are included and the number of predictors is >2 (thank you, Pascal!).

Expand Down
14 changes: 6 additions & 8 deletions R/trainNs.r
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,16 @@ trainNS <- function(
# interaction terms
if (interaction & length(preds) > 1L & n >= 2 * presPerTermFinal) {

for (countPred1 in 1L:(length(preds) - 1L)) { # for each predictor test two-variable terms
predCombos <- utils::combn(preds, m = 2, simplify = FALSE)

pred1 <- preds[countPred1]
for (i in seq_along(predCombos)) {

for (countPred2 in 2L:length(preds)) { # for each second predictor test two-variable terms
pred1 <- predCombos[[i]][1]
pred2 <- predCombos[[i]][2]

pred2 <- preds[countPred2]
terms <- c(terms, paste0('splines::ns(', preds[countPred1], ' * ', preds[countPred2], ', df=', df, ')'))
terms <- c(terms, paste0('splines::ns(', pred1, ' * ', pred2, ', df=', df, ')'))

} # next second term

} # next first term
}

} # if more than one term

Expand Down
2 changes: 1 addition & 1 deletion man/trainBrt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/trainGam.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/trainGlm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/trainNs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/trainRf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading