SCnext / SCGLR

An extension of the Fisher Scoring Algorithm to combine PLS regression with GLM estimation in the multivariate context. Covariates can be grouped in themes.
https://scnext.github.io/SCGLR/
1 stars 1 forks source link

Theme function #8

Closed tiemor75 closed 4 years ago

tiemor75 commented 4 years ago

Describe the bug Linear predictors not well evaluated

replace line from 366 to 378 by


 # compute global linear predictors
  comp <- cbind(1,as.matrix(do.call("cbind",lapply(out$themes, function(x) x$comp))))
  if(additional) {
    comp <- cbind(comp, model.matrix(theme_A, data)[,-1])
  }
  # lin.pred.global <- multivariatePredictGlm(comp, family=family, beta=gamma, offset=offset)
  lin.pred.global <- comp%*%gamma
  # Linear predictors by theme
  for(t in seq_along(out$themes)) {
    # par <- out$themes[[t]]$gamma[1:(H[t]+1),]
    par <- out$themes[[t]]$gamma[2:(H[t]+1),]#without intercept
    # out$themes[[t]]$lin.pred <- multivariatePredictGlm(cbind(1,as.matrix(out$themes[[t]]$comp)), family=family, beta=par, offset=offset)
    out$themes[[t]]$lin.pred <- as.matrix(out$themes[[t]]$comp)%*%par
    out$themes[[t]]$gamma <- gamma
    out$themes[[t]]$beta <- beta
  }