how to put constaints on coefficients obtained from regression.pm

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

•  Subject
• Author
• Posted on
Hi,

I use regression package to do a multivariate linear regression fit to
my data. Regression.pm generates coefficient values (thetas), but I
want to make them always possitive. How do I put constraints (all
coefficients are positive) when using regression package? any ideas?
thanks

Re: how to put constaints on coefficients obtained from regression.pm

nsf470@yahoo.com (pj) wrote:

I can't find a top-level module named Regression, so I don't know if it has
any specific capabilities to implement constraints.  If not, you could just
iteratively remove any variables that come back with negative coefficients
and rerun the regression.

I'm not sure that this is gauranteed to lead to a globally optimal
solution, but if you are that particular about your statistical rigour, you
probably should probably be using a commercial regression application
anyway.

Xho

--
Usenet Newsgroup Service                        \$9.95/Month 30GB

Re: how to put constaints on coefficients obtained from regression.pm

Huh? That's really strange. Regression coefficients sometimes just ARE
negative because that's the way the data is. You can transform the data
so that the coefficients are more meaningful, e.g.; taking the log or
something, but when you fit a model to your data you have to accept
what the data says, not what you want it to be. That is, if you're
honest.

Ask in a statistics group; I think they'll tell you the same thing. For
what it's worth, my job title is statistician (although I tend to do
more programming these days) and I've never heard of trying to force
all regression coefficients to be positive. The PhD statistician across
the hall (I only have a Master's in stat) hadn't either. He said it
sounded like something a psychologist would try to do. :-)

Re: how to put constaints on coefficients obtained from regression.pm

Well, there are sometimes perfectly valid reasons for calculating
restricted regressions, mostly in the realm of Likelihood Ratio tests.

I know, I know, getting off-topic here.

Sinan.

Re: how to put constaints on coefficients obtained from regression.pm

pj wrote:

Sounds like you want a program like lp_solve:

http://www.cs.sunysb.edu/~algorith/implement/lpsolve/implement.shtml

along with a bunch of other sites.

That's one that you probably don't want to reinvent in Perl.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl