Mateusz
K.
Project manager and
python programmer
Temat: rpy2, nls
Witam,jestem bardzo początkującym użytkownikiem Rpy2. Pracuję na pythonie 2.6, i R 2.9.1 oraz rpy2-2.0.8.win32-py2.6. Nie wiem jak mam zdefiniować start. Oto mój kod:
import rpy2.robjects as robjects
tab_x = [1,2,3,4,5,6,7,8,9,10]
tab_y=[2,65,23,5,7,34,98,23,5,45]
x = robjects.IntVector(tab_x)
y = robjects.IntVector(tab_y)
dfr = {"y" : y, "x" : x}
dfr = robjects.r['data.frame'](**dfr)
form = ('y~b-b(b-(1/c))^x')
starts = ('(b=0)')
wynik = robjects.r.nls(formula = form, data = dfr, start = starts)
Proszę o pomoc i z góry dziękuję
Pozdrawiam
Mateusz
edit:
a taki dostaję komunikat:
Mateusz K. edytował(a) ten post dnia 21.03.12 o godzinie 10:37
File "C:\Python26\Lib\SITE-P~1\PYTHON~2\pywin\framework\scriptutils.py", line 322, in RunScript
debugger.run(codeObject, __main__.__dict__, start_stepping=0)
File "C:\Python26\Lib\SITE-P~1\PYTHON~2\pywin\debugger\__init__.py", line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File "C:\Python26\Lib\SITE-P~1\PYTHON~2\pywin\debugger\debugger.py", line 655, in run
exec cmd in globals, locals
File "E:\nls_problem.py", line 10, in <module>
wynik = robjects.r.nls(formula = form, data = dfr, start = starts)
File "C:\Python26\lib\site-packages\rpy2\robjects\__init__.py", line 423, in __call__
res = super(RFunction, self).__call__(*new_args, **new_kwargs)
RRuntimeError: Error in function (formula, data = parent.frame(), start, control = nls.control(), :
parameters without starting value in 'data': b