Closed fabian-s closed 5 years ago
can you provide a MWE?
y <- cbind(1:10, 10:1)
x <- matrix(runif(11 *10), 11, 10)
library(gamlss.dist)
#> Loading required package: MASS
library(FDboost)
#> Loading required package: mboost
#> Loading required package: parallel
#> Loading required package: stabs
#> This is mboost 2.9-0. See 'package?mboost' and 'news(package = "mboost")'
#> for a complete list of changes.
#>
#> Attaching package: 'mboost'
#> The following object is masked from 'package:gamlss.dist':
#>
#> Family
#> This is FDboost 0.3-1.
FDboost(y ~ bsignal(x), timeformula = NULL, family = gamboostLSS::as.families(BI),
data = list(x=x, y = y))
#> Warning in gamboostLSS::as.families(BI): For boosting one-parametric
#> families, please use the mboost package.
#> Error in FDboost(y ~ bsignal(x), timeformula = NULL, family = gamboostLSS::as.families(BI), : The length of the response and number of observations of x do not match.
Created on 2019-03-16 by the reprex package (v0.2.0).
So this issue is about the BI family to fit a model for a Binomial distribution with different numbers of tries, such that the response has to be provided as a matrix? Or do you also have other cases in mind? I had a look at your example, and changed some of the data generating process and added the domain of the functional covariate. The following code works fine for me (FDboost 0.3-2. and mboost 2.9-1). I admit that the warnings are not beautiful, but as far as I can see, you can ignore them.
## use n = 11 obersvations,
## make sure that in y, the number in the first column is smaller than that in the second column
y <- cbind(rep(1, 11), 11:1)
x <- matrix(runif(11 *10), 11, 10)
xs <- seq(0, 1, l = 10)
library(gamlss.dist)
# Lade nötiges Paket: MASS
# Warning message:
# Paket ‘gamlss.dist’ wurde unter R Version 3.5.3 erstellt
library(FDboost)
# Lade nötiges Paket: mboost
# Lade nötiges Paket: parallel
# Lade nötiges Paket: stabs
# This is mboost 2.9-1. See ‘package?mboost’ and ‘news(package = "mboost")’
# for a complete list of changes.
#
# Attache Paket: ‘mboost’
#
# The following object is masked from ‘package:gamlss.dist’:
#
# Family
#
# This is FDboost 0.3-2.
# Warning message:
# Paket ‘mboost’ wurde unter R Version 3.5.3 erstellt
m <- FDboost(y ~ bsignal(x, xs), timeformula = NULL, family = gamboostLSS::as.families(BI),
data = list(x=x, y = y, xs = xs))
# x is not centered per column, inducing a non-centered effect.
# Warning messages:
# 1: In gamboostLSS::as.families(BI) :
# For boosting one-parametric families, please use the mboost package.
# 2: In df2lambda(X, df = args$df, lambda = args$lambda, dmat = K, weights = w, :
# estimated degrees of freedom differ from ‘df’ by 1.5274922660069e-08
# 3: In gamboostLSS::as.families(BI) :
# For boosting one-parametric families, please use the mboost package.
Can you give it a try and let me know if you still have troubles?
thx, sorry, must have been caused by the missing xs
argument.....
going forward, just ignore the grumpy old man muttering in the corner.
because this:
https://github.com/boost-R/gamboostLSS/blob/f97c8906fc9d78e05cb28823789b12cd31c06fdc/R/mboostLSS.R#L171
turns matrices of scalar wins/losses, e.g., into a long vector.