[R] Functions in R like lincom and nlcom of Stata

John Fox jfox at mcmaster.ca
Sun Dec 14 16:45:31 CET 2008


Dear Stas and David,

A couple of people have mentioned linear.hypothesis() in the car package,
which has methods for several kinds of models and a default method that will
work for any model that responds to coef() and vcov(). The delta.method()
function in the alr3 package is similarly general.

To find these: RSiteSearch("linear hypothesis", restrict="functions") turns
up linear.hypothesis() as the first hit; RSiteSearch("delta method",
restrict="functions") is also successful, but only finds delta.method() as
the 45th hit.

I hope this helps,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of Stas Kolenikov
> Sent: December-14-08 12:33 AM
> To: r-help at r-project.org
> Subject: Re: [R] Functions in R like lincom and nlcom of Stata
> 
> Those commands provide point estimates, standard errors and confidence
> intervals based on linear combination of parameters or
> linearization/delta-method, respectively. R's contrasts appear to be
> limited to a single factor and combinations that sum up to zero.
> 
> I am too so used to this Stata's concept, I now think it's odd R does
> not seem to have it readily identifiable in two-three search commands.
> And I would not believe R does not have this functionality, it must be
> hiding somewhere! :))
> 
> On 12/13/08, David Winsemius <dwinsemius at comcast.net> wrote:
> >
> >  On Dec 12, 2008, at 11:14 AM, Marc Marí Dell'Olmo wrote:
> >
> >
> > > Hello all,
> > >
> > > Does anyone know if there exists any function in R that resembles the
> > > "lincom" and "nlcom" of STATA?. These functions computes point
> > > estimates, standard errors, significance levels, confidence intervals,
> > > etc. for linear and non linear combinations of previous estimated
> > > parameters. Down here you've got links to descriptions of the
> > > functions of STATA
> > >
> > > nlcom:
> > > http://www.stata.com/help.cgi?nlcom
> > > lincom:
> > > http://www.stata.com/help.cgi?lincom
> > >
> >
> >  I did not find a description of the mathematical operations that let me
> > understand exactly what lincom is doing, but suspect that you should be
> > looking at how R handles contrasts. The help pages reference ch 2 of
> > "Statistical Models in S". The search at the console prompt would be:
> >
> >  ?C
> >  ?contrasts
> >  ?se.contrast
> >  ?model.tables
> >
> 
> --
> Stas Kolenikov, also found at http://stas.kolenikov.name
> Small print: I use this email account for mailing lists only.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.



More information about the R-help mailing list