Re: [R] Fit Student Copula
> set.seed(1) > student.cop <- ellipCopula("t", param = c(0.5, 0.6, 0.7), dim = 3, dispstr = > "un",df=5) > x<-rcopula(student.cop,1000) > fit <- fitCopula(x, student.cop, c(0.5,0.5,0.5,5)) Warning messages: 1: NaNs produced in: qt(p, df, lower.tail, log.p) 2: NaNs produced in: sqrt((df + d)/(Q + df)) 3: NaNs produced in: sqrt((df + d)/(Q + df)) 4: NaNs produced in: sqrt((df + d)/(Q + df)) 5: NaNs produced in: sqrt((df + d)/(Q + df)) > fit The ML estimation is based on 1000 observations. Estimate Std. Error z value Pr(>|z|) rho.1 0.4824018 0.02460306 19.607386 0.00e+00 rho.2 0.6076102 0.01993649 30.477289 0.00e+00 rho.3 0.6938202 0.01596493 43.459018 0.00e+00 df5.2299217 0.64155266 8.151976 4.440892e-16 The maximized loglikelihood is 665.585 The convergence code is 0 On 3/1/07, pierre clauss <[EMAIL PROTECTED]> wrote: > Hello everybody, > I have a big problem that I do not manage to solve ! > I will be very grateful if you can solve this ! > > I want to fit a t Copula with the copula package : > > > student.cop <- ellipCopula("t", param = c(0.5, 0.6, 0.7), dim = 3, dispstr > > = "un",df=5) > > x<-rcopula(student.cop,1000) > > fit <- fitCopula(x, student.cop, c(0.5,0.5,0.5,5)) > > And there is an error for the optimization. > > Thanks a lot if you respond to me ! > Pierre. > > > > > > > ___ > Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! > Profitez des connaissances, des opinions et des expériences des internautes > sur Yahoo! Questions/Réponses > > [[alternative HTML version deleted]] > > > __ > R-help@stat.math.ethz.ch 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. > > -- Jun Yan Assistant Professor Department of Statistics and Actuarial Science Voice: 319-335-0824 University of Iowa Fax: 319-335-3017 219 Schaeffer Hall Email: [EMAIL PROTECTED] Iowa City, IA 52242 Web: http://www.stat.uiowa.edu/~jyan __ R-help@stat.math.ethz.ch 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.
Re: [R] tCopula package question
That may indicate lack of fit. If the data is generated from the t-copula, this worked for me: set.seed(123) mycop <- tCopula(param=0.5, dim=8, dispstr = "ex", df =5) x <- rcopula(mycop, 1000) myfit <- fitCopula(x, mycop, c(0.6,10), optim.control=list(trace=1),method="Nelder-Mead") myfit On 2/7/07, aat <[EMAIL PROTECTED]> wrote: > > Hello everyone, > > I am having issues with the R copula package. Just trying to run the > example I found at this site gives me an error. > > When I implement this code: > > mycop <- tCopula(param=0.5, dim=8, dispstr = "ex", df =5) > myfit <- fitCopula(x, mycop, c(0.6,10), > optim.control=list(trace=1),method="Nelder-Mead") > myfit > > I get the following information on the search method and an error: > > Error in chol(x, pivot = FALSE) : the leading minor of order 2 is not > positive definite > > myfit > Error: object "myfit" not found > > Any ideas on why this is happening are appreciated. Thanks. > > Adam (aat) > -- > View this message in context: > http://www.nabble.com/tCopula-package-question-tf3188503.html#a8850378 > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@stat.math.ethz.ch 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. > -- Jun Yan Assistant Professor Department of Statistics and Actuarial Science Voice: 319-335-0824 University of Iowa Fax: 319-335-3017 219 Schaeffer Hall Email: [EMAIL PROTECTED] Iowa City, IA 52242 Web: http://www.stat.uiowa.edu/~jyan __ R-help@stat.math.ethz.ch 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.
Re: [R] Making R talk to Win/OpenBUGS in Linux (again)
I have used linbugs with the rbugs package for a recent work. It might be worthwhile trying. Jun On 5/1/06, Uwe Ligges <[EMAIL PROTECTED]> wrote: > > Paul Johnson wrote: > > > Thank you very much. With the insertion of WINEPATH declaration, then > > the following example program does run. And really fast, too! > > > > > > > > > > > > library(R2WinBUGS) > > > > WINEPATH <- "/usr/bin/winepath" > > > Will be fixed in the package real soon now. > Gregor, many thanks for the patches. > > Best, > Uwe Ligges > > > > # An example model file is given > in: > > model.file <- system.file(package = "R2WinBUGS", "model", "schools.txt") > > # Let's take a look: > > file.show(model.file) > > > > # Some example data (see ?schools for details): > > data(schools) > > schools > > > > J <- nrow(schools) > > y <- schools$estimate > > sigma.y <- schools$sd > > data <- list ("J", "y", "sigma.y") > > inits <- function(){ > > list(theta = rnorm(J, 0, 100), mu.theta = rnorm(1, 0, 100), > > sigma.theta = runif(1, 0, 100)) > > } > > parameters <- c("theta", "mu.theta", "sigma.theta") > > > > > > schools.sim <- bugs(data, inits, parameters, model.file, n.chains = 3, > > n.iter = 1000,bugs.directory = "/usr/local/share/WinBUGS14/", > > working.directory = "/tmp", clearWD = FALSE, useWINE=T, newWINE=T, > > WINE="/usr/bin/wine",WINEPATH=WINEPATH) > > > > > > > > > > On 4/30/06, Gregor Gorjanc <[EMAIL PROTECTED]> wrote: > > > >>Hello Paul, > >> > >>thank you very much for this report. You caught a bug in R2WinBUGS that > >>was introduced by me. I added support for winepath in 1.1-1 version. > >>Since I switch between Windows and Linux I always set WINEPATH and then > >>use it in bugs(). That's why I forgot to add it in further calls in > >>bugs(). How silly :( This actually means that nobody else beside you > >>tried to run R2WinBUGS under Linux. To bad. Please report summary to > >>BUGS list as you have also asked there for help and I did not had time > >>to answer you. I have been successfully running R2WinBUGS under Linux > >>for quite some time now. > >> > >>Now you have the following options: > >> > >>A Set WINEPATH before you call bugs() > >> > >>i.e. > >> > >>WINEPATH <- "/usr/bin/winepath" > >> > >>bugs(..., WINEPATH=WINEPATH) > >> > >>This is the fastest approach for you. > >> > >>B Apply the following diffs, build and install R2WinBUGS by yourself > >> > >>I am also sendind them to maintainer of the package. So this should be > >>fixed soon also on CRAN. Uwe? > >> > >>--- R2WinBUGSOrig/R/bugs.R 2006-04-29 21:44:59.0 +0200 > >>+++ R2WinBUGS/R/bugs.R 2006-04-30 12:52:36.0 +0200 > >>@@ -44,7 +44,7 @@ > >> } else new.model.file <- model.file > >> bugs.script(parameters.to.save, n.chains, n.iter, n.burnin, n.thin, > >> bugs.directory, new.model.file, debug=debug, is.inits=!is.null > (inits), > >>-bin = bin, DIC = DIC, useWINE = useWINE, newWINE = newWINE) > >>+bin = bin, DIC = DIC, useWINE = useWINE, newWINE = newWINE, > >>WINEPATH=WINEPATH) > >> #if (useWINE && missing(bugs.directory)) > >> # bugs.directory <- winedriveTr(bugs.directory) > >> bugs.run(n.burnin, bugs.directory, WINE = WINE) > >> > >>--- R2WinBUGSOrig/R/bugs.script.R 2006-04-29 21:44:59.0+0200 > >>+++ R2WinBUGS/R/bugs.script.R 2006-04-30 12:52:12.0 +0200 > >>@@ -1,7 +1,7 @@ > >> "bugs.script" <- > >> function (parameters.to.save, n.chains, n.iter, n.burnin, > >> n.thin, bugs.directory, model.file, debug=FALSE, is.inits, bin, > >>-DIC = FALSE, useWINE = FALSE, newWINE = FALSE){ > >>+DIC = FALSE, useWINE = FALSE, newWINE = FALSE, WINEPATH=NULL){ > >> > >> > >>>I'm back! > >>> > >>>I've just learned that, on a fully updated Fedora Core Linux5 sytem, > >>>the working solution to access Winbugs under wine via the R package > >>>"rbugs" no longer works. Here was my last post on this topic (with > >>>the formerly working solution) from January. > >>> > >>>http://finzi.psych.upenn.edu/R/Rhelp02a/archive/68497.html > >>> > >>>Currently, what happens is that WinBUGS starts up, but just sits there > >>>doing nothing. I do not know if the problem is due to a change in > >>>wine or rbugs, and since both of them are updated, it is hard to say. > >>>I'm thinking it is a wine or perhaps even a kernel related problem. > >>>Inside WinBUGS running under wine, it does not even work to manually > >>>open the bugs.script file and then choose "Model/Script". it just > >>>returns a screen full of errors saying the commands fail. I don't > >>>think rbugs gets even that far, however, since the WinBUGS window does > >>>pop up, but nothing happens. > >>> > >>>rbugs has been retooled to emphasize use of linbugs, the > >>>OpenBUGS-based thing for linux, but I can't get linbugs to run at all > >>>on my system, and the linbugs program itself appears to have been > >>>removed from OpenBUGS distribution altogether. (I'm following that > >>>with separate email to
Re: [R] the 'copula' package
Here is an example that works: > mycop <- tCopula(param=0.5, dim=8, dispstr="ex", df=5) > x <- rcopula(mycop, 1000) > myfit <- fitCopula(x, mycop, c(0.6, 10), optim.control=list(trace=1), method="Nelder-Mead") > myfit The ML estimation is based on 1000 observations. Estimate Std. Error z value Pr(>|z|) rho.1 0.4989052 0.01192036 41.853200 df5.2976624 0.32442429 16.329430 The maximized loglikelihood is 2038.907 The convergence code is 0 On 4/24/06, Casey Quinn <[EMAIL PROTECTED]> wrote: > > Is anybody using the Copula package in R? The particular problem I'm > facing is that R is not acknowledging the fitCopula command/function > when I load the package and (try to) run something very simple: > > fit1 <- fitCopula(x1 = list(u11,u12,u13,u14,u15,u16,u17,u18), tCopula, > optim.control = list(NULL), method = "BFGS") > > Anybody also using it, successfully or unsuccessfully? I'd appreciate a > tip or two. > > Casey Quinn > Centre for Health Economics > University of York > York YO10 5DD > England > > Phone: +44 01904 32 1411 > Fax:+44 01904 32 1402 > Email: [EMAIL PROTECTED] > Web: http://www.york.ac.uk/inst/che/staff/quinn.htm > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] calling La_svd from c code
I was trying to call the c function La_svd (which was used by R function La.svd) from my c code (see below), but I keep getting the following error message in the simple testing: > dyn.load("/u/j/y/jyan/ludwig/work/newgeese/feepack/src/feepack.so") > x <- matrix(1:4, 2) > .Call("try_svd", x) Error: LAPACK routine DGESVD gave error code -1 I would appreciate if someone can point out what I am missing. Thanks, --Jun ===c code #include #include SEXP La_svd(SEXP jobu, SEXP jobv, SEXP x, SEXP s, SEXP u, SEXP v, SEXP method); SEXP try_svd(SEXP x) { int *xdims; xdims = INTEGER(coerceVector(getAttrib(x, R_DimSymbol), INTSXP)); int p = xdims[1]; SEXP jobu, jobv, s, u, v, method, res; jobu = PROTECT(allocVector(STRSXP, 1)); SET_STRING_ELT(jobu, 0, mkChar("A")); jobv = PROTECT(allocVector(STRSXP, 1)); SET_STRING_ELT(jobv, 0, mkChar("A")); s = PROTECT(allocVector(REALSXP, p)); u = PROTECT(allocMatrix(REALSXP, p, p)); v = PROTECT(allocMatrix(REALSXP, p, p)); method = PROTECT(allocVector(STRSXP, 1)); SET_STRING_ELT(jobu, 0, mkChar("dgesvd")); res = PROTECT(La_svd(jobu, jobv, x, s, u, v, method)); UNPROTECT(7); return res; } __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help