[R] Over-constrained? gamma mixtures using R: mix{mixdist}

Roger Humphry roger.w.humphry at googlemail.com
Wed Feb 23 14:45:01 CET 2011


Dear R-help,
my aim is to fit a constrained 2 component gamma mixture using mix 
within package mixdist. The constraints being fixing both of the means 
and both of the sigmas. Thus the only unconstrained parameter I wish to 
fit is pi the proportions of the mixtures.

This is the code I used:
PP2Pars<-data.frame(c(0.23,0.77), c(9.174,29.54), c(9.983,12.369)); 
names(PP2Pars)<-c("pi", "mu", "sigma")
mixk2<-mix(NotLinkedPP3, PP2Pars, 
dist="gamma",constr=list(conpi="NONE",conmu = "MFX", consigma = "SFX", 
fixpi = NULL, fixmu = c(TRUE,TRUE),  fixsigma = c(TRUE,TRUE), cov = 
NULL, size = NULL))

If I allow any one of the 4 constrained parameters to become 
unconstrained then the model runs and gives sensible results but if I 
constrain all four parameters then I get the following error.

"Error in nlm(multineg2llg, mulpseudomixdat = mspseudomixdat, mulmixpar 
= msmixpar,  :
   invalid parameter length"

My hunch is that this is not a data-specific issue but something to do 
with over-constraining the model but I can't see why and I can't find 
this question having been asked before.
Please can you advise me why this is a problem and whether there is a 
way of doing what I wish to do.
yours,
Roger Humphry

-- 
Dr Roger Humphry, Applied Statistician,
Epidemiology Research Unit, SAC, Inverness
01463 246059



More information about the R-help mailing list