[R] VGAM constraints-related puzzle

Edward Wallace ewjwallace at gmail.com
Sun Jul 3 22:39:46 CEST 2011

Edward Wallace <ewjwallace <at> gmail.com> writes:

> Hello R users,
> I have a puzzle with the VGAM package, on my first excursion into
> generalized additive models, in that this very nice package seems to
> want to do either more or less than what I want.
> Precisely, I have a 4-component outcome, y, and am fitting multinomial
> logistic regression with one predictor x. What I would like to find
> out is, is there a single nonlinear function f(x) which acts in place
> of the linear predictor x. There is a mechanistic reason to believe
> this is sensible. So I'd like to fit a model
> \eta_j = \beta_{ (j) 0 } + \beta_{ (j) x } f(x)
> where both the function f(x) and its scaling coefficients  \beta_{ (j)
> x } are fit simultaneously. Here \eta_j is the linear predictor, the
> logodds of outcome j vs the reference outcome. I cannot see how to fit
> exactly this.

Thomas Yee wrote :
> Hello,
> try
> rrvglm(y ~ 1 + bs(x), fam = multinomial, trace = TRUE)
> It seems what you want is a stereotype model with
> a smooth function.
> Unfortunately rrvglm() is restricted to regression splines.

Thank you very much. This seems to work, but occasionally quits
producing the cryptic error
"Error in devmu[smallmu] = smy * log(smu) :
  NAs are not allowed in subscripted assignments"

Any ideas?

> You could extract out the scaling coeffs and feed them
> into vgam() using the constraints argument, but that
> would not be optimal in any strict sense.
Really? I thought I had tried adding constraint matrices such as [1 ;
2] and vglm raised an error saying it needed entries to be 1 or 0. I
can check that if you'd like.


Edward Wallace, PhD
Harvard FAS center for Systems Biology

More information about the R-help mailing list