Re: [R] I made some progress on my previous "systemfit" question but still not quite there

From: Martin Becker <martin.becker_at_mx.uni-saarland.de>
Date: Thu, 24 May 2007 09:44:45 +0200

Leeds, Mark (IED) schrieb:
> Surprisingly, I played around with some test code and below actually
> creates equations that look correct.
>
> tempmat<-matrix(10,nrow=6,ncol=6)
> restrictmat<-diag(6)
>
> colnames(tempmat)<-c("AUD.l1","CHF.l1","CAD.l1","GBP.l1","EUR.l1","JPY.l
> 1")
> rownames(tempmat)<-c("AUD","CHF","CAD","GBP","EUR","JPY")
>
> eqn<-list()
>
> for ( i in 1:6 ) {
>
> datares <- tempmat[, which(restrictmat[i, ] == 1),drop=FALSE]
> eqn[[i]]<-paste(rownames(tempmat)[i]," ~","-1","+",colnames(datares))
>
> print(eqn[[i]])
>
> }
>
> The only problem now is that I don't know how to name them so that
> I can do the
>
> system<-list( demand = eqDemand, supply = eqSupply)
>
> part that systemfit needs. In fact, I don't know how to name the actual
> equation eqDemand or the named part demand.
>
>

I am not sure, what you want to do exactly, but I suppose you need

   eqn <- lapply(eqn,as.formula)
somewhere after creating eqn. You can assign names to the equations via   names(eqn),
but this is not necessary, you can simply pass the equations with   systemfit(eqns=eqn...........),
and optionally specify the names of the equations with eqnlabels=.... instead.

If you want multiple systemfit calls for subsets of the equations, you should be able to select the equations via [], e.g., eqns=eqn[1:2] for the first and second equation.

HTH,   Martin

> I would want demand to be "AUD", supply to be "CHF", etc. If someone has
> time to run the code, they would see what I mean.
> Thanks a lot.
> --------------------------------------------------------
>
> This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch 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_at_stat.math.ethz.ch 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. Received on Thu 24 May 2007 - 07:57:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 May 2007 - 09:31:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.