Creating a function that returns a series (not a real)
Posted: Fri May 27, 2011 11:28 am
Dear all,
I have a complex nonlinear model which for which I need to use custom functions. In particular I would like to define the to-be-optimized equation as:
frm1 f1 seriesOfIndepVars = %functionReturningDepVars
where "seriesOfIndepVars" is a given series of observed values and "%functionReturningDepVars" is a custom function that is supposed to return a series containing the dependent variables as produced by my model.
My problem now is the following: Despite having read the manuals, I have not yet succeeded in creating a function that returns a series (and not a real). Studying the manual, I thought it should work like this, but it does not:
function %functionReturningDepVars z
type series %functionReturningDepVars
set %functionReturningDepVars = loanV * z^2
end
where loanV is a given global variable of type series. My actual function is much more complicated, this is just for illustration.
If I now try to use this function in my nonlinear model or if I try to call it using
set testVar = %functionReturningDepVars(2.5)
I get
Expected Type REAL, Got SERIES Instead
I should mention that I use version 5. Any help would be greatly apprechiated,
many thanks
Timo
I have a complex nonlinear model which for which I need to use custom functions. In particular I would like to define the to-be-optimized equation as:
frm1 f1 seriesOfIndepVars = %functionReturningDepVars
where "seriesOfIndepVars" is a given series of observed values and "%functionReturningDepVars" is a custom function that is supposed to return a series containing the dependent variables as produced by my model.
My problem now is the following: Despite having read the manuals, I have not yet succeeded in creating a function that returns a series (and not a real). Studying the manual, I thought it should work like this, but it does not:
function %functionReturningDepVars z
type series %functionReturningDepVars
set %functionReturningDepVars = loanV * z^2
end
where loanV is a given global variable of type series. My actual function is much more complicated, this is just for illustration.
If I now try to use this function in my nonlinear model or if I try to call it using
set testVar = %functionReturningDepVars(2.5)
I get
Expected Type REAL, Got SERIES Instead
I should mention that I use version 5. Any help would be greatly apprechiated,
many thanks
Timo