[R] how to use attr?

John Fox jfox at mcmaster.ca
Wed Jan 9 00:25:28 CET 2002


Dear Jeff,

The tsls function in the SEM package does 2SLS estimation using a formula 
interface for both the structural equation and the instruments. It only 
estimates one equation at a time, but perhaps you can use it as a model.

I hope that this helps,
  John

At 11:54 AM 1/8/2002 -0800, Jeff D. Hamann wrote:
>I'm trying to build a flexible OLS/SUR/2SLS/3SLS package and I'm having
>trouble getting some information out of a formula. For example....
>
># set up the system of equations
>demand    <- q ~ p + d
>supply    <- q ~ p + f + a
>inst    <- ~ d + f + a
>systemeq   <- list( demand, supply )
>
>...blah, blah, blah...
>
># get the number if instruments...
># or build the "bigX"...
>#I need to get a print of the variables to build a large matrix...
>print( attr( systemeq[[1]], "variables" ) )
>
>I've tried all kinds of variants...
>names( systemeq[[1]] )
>names( systemeq[[1]]$formula )

-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list