On Tue, 27 Feb 2018, Mike Lasarev wrote:
Is there some way to make the cdf and pdf functions work with
series arguments for the parameter values?
For instance: 'series p = cdf(G, mu, 1.0, y)' , where 'mu' and
'y'
are both series.
These functions in effect assume stationarity of the data, so No,
the parameters cannot take the form of series. But it's not
difficult to write your own function for the non-stationary case (if
it can't be handled just by differencing). Here's a trivial example:
<hansl>
function series ns_cdf (const series y, const series mu)
series c
loop t=$t1..$t2 -q
c[t] = cdf(z, y[t] - mu[t])
endloop
return c
end function
nulldata 10
setobs 1 2000
genr time
series y = time + normal()
series c = ns_cdf(y, time)
print y c --byobs
<hansl>
In this case it would, of course, be easier just to do
series c = cdf(z, y-time)
but I imagine you can see how more complex cases could be handled in
analogous fashion.
Allin Cottrell