cop {dsfa} | R Documentation |
The cop implements multiple copula distributions in which the parameter \delta
can depend on additive predictors.
Useable with mgcv::gam
, the additive predictors are specified via a formula.
cop(link = list("glogit"), W, distr = "normal", rot = 0)
link |
formula, specifying the link for |
W |
numeric matrix of pseudo observations. Must have two columns. |
distr |
string, defines the copula family: |
rot |
integer determining the rotation for Archimedian copulas. Can be |
Mostly internal function. Used with gam to fit copula model, which in turn is used for starting values. The function gam
is from the mgcv package and is called with a formula.
The formula specifies a dummy on the left hand side and the structure of the additive predictor for the \delta
parameter on the right hand side.
Link function is "generalized logit", where for each distr
argument there are specific min
and max
arguments, which are the boundaries of the parameter space.
Although the parameter space is larger in theory for some copulas, numeric under- and overflow limits the parameter space. The intervals for the parameter delta
are provided by [delta_bounds()].
WARNING: Only the estimates of the coefficients are useful. The rest of the 'mgcv' object has no meaningful values,
as gam()
was more or less abused here.
An object inheriting from class general.family
of the mgcv package, which can be used in the 'mgcv' and 'dsfa' package.
Schmidt R, Kneib T (2023). “Multivariate distributional stochastic frontier models.” Computational Statistics & Data Analysis, 107796.
Wood SN, Fasiolo M (2017). “A generalized Fellner-Schall method for smoothing parameter optimization with application to Tweedie location, scale and shape models.” Biometrics, 73(4), 1071–1081.
Aigner D, Lovell CK, Schmidt P (1977). “Formulation and estimation of stochastic frontier production function models.” Journal of econometrics, 6(1), 21–37.
Kumbhakar SC, Wang H, Horncastle AP (2015). A practitioner's guide to stochastic frontier analysis using Stata. Cambridge University Press.
Azzalini A (2013). The skew-normal and related families, volume 3. Cambridge University Press.
Schmidt R, Kneib T (2020). “Analytic expressions for the Cumulative Distribution Function of the Composed Error Term in Stochastic Frontier Analysis with Truncated Normal and Exponential Inefficiencies.” arXiv preprint arXiv:2006.03459.
Other copula:
dcop()
,
delta_bounds()
#Set seed, sample size and type of copula
set.seed(1337)
N=500 #Sample size
cop="gumbel" #copula
rot=180 #rotation
#Generate covariates
x1<-runif(N,-1,1); x2<-runif(N,-1,1)
#Set parameters of the copula
eta<-matrix(1+2.5*x1+1.75*sin(pi*x2),nrow=N)
delta<-transform(x=eta, type="glogitinv", par=as.numeric(delta_bounds(cop)), deriv_order = 0)
#Simulate pseudo observations W and create dataset
dat<-as.data.frame(rcop(n=N, delta=delta, distr=cop, rot=rot))
dat$y<-1 #Add dummy response variable
#Write formulae for parameters
delta_formula<-y~x1+s(x2,bs="ps")
#Fit model
model<-mgcv::gam(delta_formula, data=dat,
family=cop(W=dat[,1:2],
distr=cop, rot=rot),
optimizer="efs")
#Smooth effects
#Effect of x2 on the predictor of delta
plot(model, select=1) #Estimated function
lines(x2[order(x2)], 1.75*sin(pi*x2[order(x2)])-
mean(1.75*sin(pi*x2)), col=2) #True effect