Skip to content

Commit

Permalink
make form.type = "classic" default, closing #5
Browse files Browse the repository at this point in the history
  • Loading branch information
mayrandy committed Jun 18, 2018
1 parent 067fbc0 commit 953573c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion R/betaboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# when ~ bols(x1) + bbs(x2) -> gamboost LSS

betaboost <- function(formula = NULL, phi.formula = NULL, data = list(), sl = 0.01,
iterations = 100, form.type = c("gamboost", "classic"),
iterations = 100, form.type = c("classic", "betaboost"),
start.mu = NULL, start.phi = NULL,
stabilization = c("none", "MAD", "L2"),
y = NULL, x = NULL, mat.parameter = c("mean", "both"),
Expand Down
2 changes: 1 addition & 1 deletion man/betaboost.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Wrapper function to use mode-based boosting via mboost or gamboostLSS to fit bet
}
\usage{
betaboost(formula = NULL, phi.formula = NULL, data = list(), sl = 0.01,
iterations = 100, form.type = c("gamboost", "classic"),
iterations = 100, form.type = c("classic", "betaboost"),
start.mu = NULL, start.phi = NULL,
stabilization = c("none", "MAD", "L2"),
y = NULL, x = NULL, mat.parameter = c("mean", "both"),
Expand Down
18 changes: 9 additions & 9 deletions tests/glmtest.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rb2 <- R2.betaboost(model = b2, data = data)

b2b <- betaboost(formula = y ~ bols(x1) + bbs(x2), data = data, form.type = "gamboost",
iterations = 120, sl = 0.1)
b2c <- betaboost(formula = y ~ x1 + bbs(x2), data = data,
b2c <- betaboost(formula = y ~ x1 + s(x2), data = data,
iterations = 120, sl = 0.1)
g2 <- gamboost(y ~ bols(x1) + bbs(x2), data = data, family = BetaReg(),
control = boost_control(mstop = 120))
Expand All @@ -51,7 +51,7 @@ cbind(rb1, rg1, rb2, rg2)

b3 <- betaboost(formula = y ~ x1 + x2,
phi.formula = y ~ x3 + x4,
data = data, form.type = "classic",
data = data,
iterations = 120, sl = 0.1)
R2.betaboost(b3, data = data)

Expand All @@ -65,7 +65,7 @@ stopifnot(identical(coef(b3, off2int = TRUE),

b3b <- betaboost(formula = y ~ x1 + x2,
phi.formula = y ~ x3 + x4,
data = data, form.type = "classic",
data = data,
iterations = 400, method = "noncyclic", sl = 0.1)
R2.betaboost(b3, data = data)

Expand All @@ -79,7 +79,7 @@ stopifnot(identical(round(unlist(coef(b3b, off2int = TRUE)),2),

b4 <- betaboost(formula = y ~ s(x1) + x2,
phi.formula = y ~ x3 + s(x4),
data = data, form.type = "classic",
data = data,
iterations = 120, sl = 0.1)

g4 <- gamboostLSS(list(mu = y ~ bbs(x1) + bols(x2),
Expand Down Expand Up @@ -127,18 +127,18 @@ stopifnot(identical(coef(b1, off2int = TRUE),

## matrix interface: linear

b5 <- betaboost(formula = NULL, data = data, form.type = "classic",
b5 <- betaboost(formula = NULL, data = data,
iterations = 120, sl = 0.1, y= data$y, x = data$x1, mat.effect = "linear")
g5 <- glmboost(y ~ x1, data = data, control = boost_control(mstop = 120),
family = BetaReg())
stopifnot(identical(as.numeric(coef(b5)), as.numeric(coef(g5))))
b6 <- betaboost(formula = NULL, data = data, form.type = "classic",
b6 <- betaboost(formula = NULL, data = data,
iterations = 120, sl = 0.1, y= data$y, x = data$x1,
mat.effect = "linear", mat.parameter = "both")
g6 <- glmboostLSS(y ~x1, data = data, control = boost_control(mstop = 120),
families = BetaLSS())
stopifnot(identical(as.numeric(unlist(coef(g6))), as.numeric(unlist(coef(b6)))))
b6b <- betaboost(formula = NULL, data = data, form.type = "classic",
b6b <- betaboost(formula = NULL, data = data,
iterations = 120, sl = 0.1, y= data$y, x = as.matrix(cbind(data$x1, data$x2, data$x3)),
mat.effect = "linear", mat.parameter = "both")
g6b <- glmboostLSS(y ~x1 + x2 +x3, data = data, control = boost_control(mstop = 120),
Expand All @@ -147,12 +147,12 @@ g6b <- glmboostLSS(y ~x1 + x2 +x3, data = data, control = boost_control(mstop =

## matrix interface: nonlinear

b7 <- betaboost(formula = NULL, data = data, form.type = "classic", mat.parameter = "mean",
b7 <- betaboost(formula = NULL, data = data, mat.parameter = "mean",
iterations = 120, sl = 0.1, y= data$y, x = data$x1, mat.effect = "smooth")
g7 <- gamboost(y ~ x1, data = data, control = boost_control(mstop = 120),
family = BetaReg())
stopifnot(identical(as.numeric(unlist(coef(b7))), as.numeric(unlist(coef(g7)))))
b8 <- betaboost(formula = NULL, data = data, form.type = "classic",
b8 <- betaboost(formula = NULL, data = data,
iterations = 120, sl = 0.1, y= data$y, x = data$x1,
mat.effect = "smooth", mat.parameter = "both")
g8 <- gamboostLSS(y ~x1, data = data, control = boost_control(mstop = 120),
Expand Down

0 comments on commit 953573c

Please sign in to comment.