Hi
I am trying to use the "plm" panel data package in R through Rpy.
The "plm" package needs either the variables supplied in a certain order (in my
example the first two columns have to be id and year) or use of the plm.data
method to supply certain indices.
Here is is test program which I can't quite get to work.
id = [1,1,1,2,2,2,3,3,3,4,4,4]
year = [1970,1971,1972, 1970, 1971, 1972, 1970, 1971, 1972, 1970, 1971, 1972]
y = [2170, 2655, 1345, 2560, 2330, 3325, 2747, 3735, 3265,3453, 4653, 4563]
x1 = [33, 26, 33, 34, 24, 18, 25, 36, 20, 35, 56, 23]
x2 = [500, 654, 390, 845, 234, 458, 233, 234, 853, 345, 346, 345]
rpy.set_default_mode(rpy.NO_CONVERSION)
testdata = rpy.r.data_frame(ids=id, years=year, ys=y, x1s=x1, x2s=x2)
testdata_1 = rpy.r.plm_data(testdata, index = rpy.r.c("ids", "years"))
stuff = rpy.r.plm(("ys ~ x1s"), data=testdata_1, model="within")
rpy.set_default_mode(rpy.BASIC_CONVERSION)
results = rpy.r.summary(stuff)['CoefTable']
The program stumbles at:
File "py_rTest.py",
stuff = rpy.r.plm(("ys ~ x1s + x2s"), data=testdata_1, model="within")
rpy.RPy_RException: Error: inherits(object, "formula") is not TRUE
I any ideas how to get this working? So far I have found Rpy to be a great way
of using the power of R.
Thanks
Ryan
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list