[R] Using copulas with user-defined marginal functions

David Winsemius dwinsemius at comcast.net
Mon Apr 22 04:07:35 CEST 2013


Readers of this list should have been advised that this question has also been posted to StackOverflow:

(And the unnamed package from which dMvdc is assumed to be coming from is 'copula'.)

-- 
David
On Apr 21, 2013, at 4:12 PM, Elisa Taveras Pena wrote:

> I am trying to make a loglikelihood function using copulas. I am trying to
> use mvdc to find the density function. When I run this I got the error that
> the pdf and cdf of my function tobit doesn't exist. Can somebody guide me
> where my mistake is?
> 
> dtobit <- function(beta,sigma, x, y) {ifelse(y>0, dnorm(y,x%*%beta,
> sigma),(1-pnorm((x%*%beta)/sigma)))}
> ptobit <- function(beta,sigma, x, y) {ifelse(y>0,
> pnorm((y-x%*%beta)/sigma),(1-pnorm((x%*%beta)/sigma)))}
> myMvdc <- mvdc(copula = ellipCopula("normal", param = c(rho12, rho13,
> rho23),dim = 3, dispstr = "un"),
>        margins = c("tobit", "tobit", "tobit"),
>        paramMargins = list(list(beta=beta1,sigma=s1),
> list(beta=beta2,sigma=s2), list(beta=beta3,sigma=s3)))
> mydmvdc <- dMvdc(y, myMvdc)
> 
> Error in eval(expr, envir, enclos) : could not find function "ptobit"
> 
> 
> Thanks in advance,
> 
> 
> Elisa.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list