[R] Zelig method setx()
Corey Dow-Hygelund
godelstheory at gmail.com
Thu Feb 19 02:20:50 CET 2009
Hello,
I am attempting to "automate" a Bayesian normal linear regression
using Zelig. Basically, I have a list containing several zelig()
objects, each having a different formula, same data set, and same
model (normal.bayes).
My problem lies in the setx() method, where I am setting a numeric
parameter to a value other than the mean. This is straightforward if
I input the parameters name into setx(). i.e.,
setx.out<-setx(zelig.model, parameter1=20)
where parameter1 is the name of the given parameter.
To automate this process, via a for loop, I need to reference the
parameter from the zelig.model object, by using a index. i.e,.
for (i in 1:10){
setx.out<-setx(zelig.model, zelig.model$coefficients[4] <- value*i
}
So far, I have not had any luck of the sort.
I have looked over the setx.default.R source code, but it is still Greek to me.
There is always the convoluted option of manually setting the setx.out
values, i.e.,
setx.out[4]<- value
But this runs into the problem of having to also update 2nd order and
higher terms in the linear regression. My hope is to have the code
support general formula models; hence, the code would not know which
values in the setx.out object to update.
Corey
More information about the R-help
mailing list