Re: [R] Functions in R like lincom and nlcom of Stata
On Sun, 14 Dec 2008, John Fox wrote: 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. Despite its name, svycontrast() in the survey package also works for anything with coef() and vcov() methods, for both linear and nonlinear combinations. -thomas Thomas Lumley Assoc. Professor, Biostatistics tlum...@u.washington.eduUniversity of Washington, Seattle __ R-help@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.
Re: [R] Functions in R like lincom and nlcom of Stata
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-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Stas Kolenikov > Sent: December-14-08 12:33 AM > To: r-help@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 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@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. __ R-help@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.
Re: [R] Functions in R like lincom and nlcom of Stata
On Sat, 13 Dec 2008, Stas Kolenikov wrote: 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! :)) It really depends on the class of models, e.g. se.contrast() applies to aov models, including multistratum ones. In general (as it is generic) vcov() provides a good starting point. For linear models there are lots of approaches in contributed packages. (E.g. gmodels::estimable, car::linear.hypothesis, the effects package.) That said, I find myself needing this very rarely. Two general principles may help 1) set up models so the quantities of interest are parameters (and for linearly-parametrized models, use C() and contrasts() to do so). 2) Interesting quantities from models are almost always based on predictions, and hence most often only linear combinations of parameters in linear models. Simulation is a good way to assess the uncertainty of such quantities. On 12/13/08, David Winsemius 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@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. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@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.
Re: [R] Functions in R like lincom and nlcom of Stata
There is function for linear combination in car package as well. Best Ronggui On Sun, Dec 14, 2008 at 1:42 PM, Andrew Robinson wrote: > > estimable in the gmodels package provides point estimates, standard > errors and confidence intervals for arbitrary linear combinations of > model parameters. I don't know for non-linear combinations, though. > > Cheers > > Andrew > > On Sat, Dec 13, 2008 at 11:33:12PM -0600, Stas Kolenikov wrote: >> 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 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@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. > > -- > Andrew Robinson > Department of Mathematics and StatisticsTel: +61-3-8344-6410 > University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 > http://www.ms.unimelb.edu.au/~andrewpr > http://blogs.mbs.edu/fishing-in-the-bay/ > > __ > R-help@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. > -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong Website: http://ronggui.huang.googlepages.com/ RQDA project: http://rqda.r-forge.r-project.org/ __ R-help@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.
Re: [R] Functions in R like lincom and nlcom of Stata
estimable in the gmodels package provides point estimates, standard errors and confidence intervals for arbitrary linear combinations of model parameters. I don't know for non-linear combinations, though. Cheers Andrew On Sat, Dec 13, 2008 at 11:33:12PM -0600, Stas Kolenikov wrote: > 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 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@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. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-6410 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/ __ R-help@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.
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 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@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.
Re: [R] Functions in R like lincom and nlcom of Stata
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 Thank you, Marc __ R-help@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. __ R-help@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.
[R] Functions in R like lincom and nlcom of Stata
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 Thank you, Marc __ R-help@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.
[R] Functions in R like lincom and nlcom of Stata
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 Thank you, Marc [[alternative HTML version deleted]] __ R-help@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.