Dear users
I am reposting this and hope it will be accepted this time.

I am using copula package to fit my bivariate data and simulation. As
explained in package documentation we can use our own data distribution to
feed on copula as long as we have d, p and q (pdf, cdf and quantile)
functions are available.  Hence my code for those are:

# Make the functions for data distribution
dSAR<-function(SAR){dexp(SAR, rate=0.5)}
pSAR<-function(SAR){pexp(SAR, rate=0.5)}
qSAR<-function(SAR){qexp(c(seq(0,1, .01)),SAR, rate=0.5)}


dper<-function(per) {dexp(per,rate=0.5)}
pper<-function(per){pexp(per,rate=0.5)}
qper<-function(per){qexp(c(seq(0,1,.01)),per, rate=0.5)}

gmb<-gumbelCopula(3,dim=2) # create bivariate copula object with dim=2

#tau(gmb)
## construct a bivariate distribution with defined marginals
 myCDF<- mvdc(gmb, margins=c("exp","exp"),
            paramMargins=list(list(rate=0.5),list(rate=0.5)))

# Use own data for bivariate CDF construction
myCDF2<- mvdc(gmb, margins=c("SAR","per"),
            paramMargins=list(list(rate=.5),list(rate=.5)))

# Generate (bivariate) random numbers from that, and visualize
x <- rMvdc(1000, myCDF2)

And I get error message everytime as:
> x <- rMvdc(1000, myCDF2)
Error in qSAR(x, rate = 0.5) : unused argument(s) (rate = 0.5)

It works fine with  myCDF and generate bivariate data:
x <- rMvdc(1000, myCDF2)

But my problem is simulated data (using myCDF) does not show the same
relationship as in original data.  Hence I want to use my own empirical
distribution (myCDF2) to simulate data.  It looks like it is not taking the
quantile function, qSAR. Is there any other way I can define my data
distribution and feed  to copula ?   Thanks for help.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to