I am trying to write a custom model for gnm
, to fit Voigt profiles.
I have defined
library(gnm) ; library(RcppFaddeeva)
VOIGT <- function(x) {
list(predictors=list(Center=1, Sigma=1, Gamma=1, Alfa=1),
variables=list(substitute(x)),
term=function(predLabels, varLabels) {
paste(predLabels[4], "* RcppFaddeeva::Voigt(", varLabels[1], ", ", predLabels[1], ", ", predLabels[2], ", ", predLabels[3], ")" )
},
start=function(theta) {
theta[2] <- 1 ; theta[3] <- 1; theta[4] <- 1
} )
}
class(VOIGT) <- "nonlin"
but trying to use it gives
Error in deriv.default(X[[i]], ...) :
Function 'RcppFaddeeva::Voigt' is not in the derivatives table
Any workarounds? Or does this need extensions to gnm
, or some completely other approach?