How to only include some covariates in a vglm model depending on the linear predictor?
I am modelling a positive random variable with VGAM R-package with a truncated normal distribution. I want to include some explanatory variables to model the mean and other explanatory variables to model the standard deviation.
I try to do this with the "constraints" argument of vglm function.
Here is an example with the "iris" dataset (it is not the actual data I will use). I want to model the Sepal.Length's mean with the Sepal.Width, and the Sepal.Length's standard deviation with the Petal.Length and the Petal.Width.
Here is my code, with the list of constraints as I understood it should be written.
library ( VGAM ) iris = iris
constraints = list ( "(Intercept)" = diag ( 2 ), Sepal.Width = rbind ( 1 , 0 ), Petal.Length = rbind ( 0 , 1 ), Petal.Width = rbind ( 0 , 1 )) formula = Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width
out = vglm ( formula , posnormal ( zero = NULL ), data = iris , constraints = constraints )
This is not what I entered, because there has been some postprocessing of my initial constraint list, which adds some columns in the constraint matrix before getting to the process.constraints function.
I don't get if this is a bug or if I did not initially write the right constraints for what I want to do. Or maybe should I proceed differently?
I already posted this question on StackOverflow, but don't get any answer.
Thanks for you help,
Ingénieur d'études et de développement
42 avenue Coriolis
31057 Toulouse cedex 05