The ST3 derivatives enforce various bounds on the dsq1 and dsq2 objects using ifelse.
However, ifelse poorly handles non-matching lengths of the inputs. Consider this example:
Evaluate to the first element of the vector (tau+1)/(tau+dsq1) and (tau+1)/(tau+dsq2). I believe outputting the whole vectors (tau+1)/(tau+dsq1) and (tau+1)/(tau+dsq2) would be correct here.
I suggest to fix that by repeating the input so that it matches the length of y which determines the length of dsq1 and dsq2. Like so: rep(tau, length(y)).
The ST3 derivatives enforce various bounds on the
dsq1
anddsq2
objects usingifelse
. However,ifelse
poorly handles non-matching lengths of the inputs. Consider this example:This evaluates to
1
.Similarly in
ST3()$dldm
Evaluate to the first element of the vector
(tau+1)/(tau+dsq1)
and(tau+1)/(tau+dsq2)
. I believe outputting the whole vectors(tau+1)/(tau+dsq1)
and(tau+1)/(tau+dsq2)
would be correct here. I suggest to fix that by repeating the input so that it matches the length ofy
which determines the length ofdsq1
anddsq2
. Like so:rep(tau, length(y))
.This is what this PR does.
Best regards, BerriJ