Dear all, 





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 ) 


Here are my constraint list: 
$ `(Intercept)` [, 1 ] [, 2 ] [ 1 ,] 1 0 [ 2 ,] 0 1 $ Sepal.Width [, 1 ] [ 1 ,] 
1 [ 2 ,] 0 $ Petal.Length [, 1 ] [ 1 ,] 0 [ 2 ,] 1 $ Petal.Width [, 1 ] [ 1 ,] 
0 [ 2 ,] 1 


I get the following error message from function process.constraints: 
Error in process.constraints ( constraints , x = x , M = M , specialCM = 
specialCM , : constraint matrix has too many columns " 


This function takes as argument a list of constraint matrices, which appears to 
be : 
$ `(Intercept)` [, 1 ] [, 2 ] [, 3 ] [, 4 ] [ 1 ,] 1 1 0 0 [ 2 ,] 0 0 1 1 $ 
Sepal.Width [, 1 ] [, 2 ] [ 1 ,] 1 1 [ 2 ,] 0 0 $ Petal.Length [, 1 ] [, 2 ] [ 
1 ,] 0 0 [ 2 ,] 1 1 $ Petal.Width [, 1 ] [, 2 ] [ 1 ,] 0 0 [ 2 ,] 1 1 


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, 


Michaël Zamo 
Ingénieur d'études et de développement 

Météo-France 
DirOP/COMPAS/DOP 
bureau B315 
42 avenue Coriolis 
31057 Toulouse cedex 05 
France 

Tél. : +33 5 61 07 86 36 
Courriel : michael.z...@meteo.fr 


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to