[R] Fwd: (nonparametric) Copula density estimation

David Winsemius dwinsemius at comcast.net
Sun Aug 4 18:55:02 CEST 2013


That instance of 's' is a function and you were offering it (multiplied by 5) as a data argument to the theta parameter of 'persp'. I can't intuit what your reasoning might have been because you haven't explained why you thought that would succeed.

-- 
David

Sent from my iPhone

On Aug 3, 2013, at 8:52 PM, marta Garcia <marta000garcia at gmail.com> wrote:

> Dennis, David, The code I'm running is from here:
> 
> http://www.r-bloggers.com/nonparametric-copula-density-estimation/
> 
> s comes from  here:
> 
> 
> 
> s {mgcv}
> 
> *Defining smooths in GAM formulae*
> 
> *Package: *
> 
> mgcv
> 
> *Version: *
> 
> 1.7-24
> 
> *Description*
> 
> Function used in definition of smooth terms within
> *gam*<http://inside-r.org/r-doc/mgcv/gam> model
> formulae. The function does not evaluate a (spline) smooth - it exists
> purely to help set up a model using spline based smooths.
> 
> *Usage*
> 
> s(..., k=-1,fx=FALSE,bs="tp",m=NA,by=NA,xt=NULL,id=NULL,sp=NULL)
> 
> The mgcv package is installed and loaded
> 
> 
> 
> 
> 
> 
> la function persp  is in  the package  graphics   persp {graphics}
> 
> *perspective plots*
> 
> *package: *
> 
> graphics
> 
> *version: *
> 
> r 3.0.1
> try installing graphics and tells me it can not be installed in version
> 3.0.1 of R
> 
> 
> 
> 
> 
> 
> 2013/8/3 marta Garcia <marta000garcia at gmail.com>
> 
>> The code I'm running is from here:
>> 
>> http://www.r-bloggers.com/nonparametric-copula-density-estimation/
>> 
>> s comes from  here:
>> 
>> 
>> 
>> s {mgcv}
>> 
>> *Defining smooths in GAM formulae*
>> 
>> *Package: *
>> 
>> mgcv
>> 
>> *Version: *
>> 
>> 1.7-24
>> 
>> *Description*
>> 
>> Function used in definition of smooth terms within *gam*<http://inside-r.org/r-doc/mgcv/gam> model
>> formulae. The function does not evaluate a (spline) smooth - it exists
>> purely to help set up a model using spline based smooths.
>> 
>> *Usage*
>> 
>> s(..., k=-1,fx=FALSE,bs="tp",m=NA,by=NA,xt=NULL,id=NULL,sp=NULL)
>> 
>> The mgcv package is installed and loaded
>> 
>> 
>> 
>> 
>> 
>> 
>> la function persp  is in  the package  graphics   persp {graphics}
>> 
>> *perspective plots*
>> 
>> *package: *
>> 
>> graphics
>> 
>> *version: *
>> 
>> r 3.0.1
>> try installing graphics and tells me it can not be installed in version
>> 3.0.1 of R
>> 
>> 
>> 
>> 
>> 
>> 
>> 2013/8/3 David Winsemius <dwinsemius at comcast.net>
>> 
>>> 
>>> 
>>> Sent from my iPhone
>>> 
>>> On Aug 3, 2013, at 8:27 AM, marta Garcia <marta000garcia at gmail.com>
>>> wrote:
>>> 
>>>> ---------- Forwarded message ----------
>>>> From: marta Garcia <marta000garcia at gmail.com>
>>>> Date: 2013/8/3
>>>> Subject: (nonparametric) Copula density estimation
>>>> To: r-help at r-project.org
>>>> 
>>>> 
>>>> Hello community, sorry for the English, I speak Spanish ...
>>>> I try to run this code
>>>> 
>>>> 
>>>> install.packages("MASS")
>>>> 
>>>> library(MASS)
>>>> install.packages ("evd")
>>>> library(evd)
>>>> 
>>>> 
>>>> X=lossalae
>>>> U=cbind(rank(X[,1])/(nrow(X)+1),rank(X[,2])/(nrow(X)+1))
>>>> The standard tool to plot nonparametric estimators of densities is to
>>> use
>>>> multivariate kernels. We can look at the density using
>>>> 
>>>> mat1=kde2d(U[,1],U[,2],n=35)
>>>> install.packages("mgcv")
>>>> library(mgcv)
>>>> 
>>>> 
>>>> persp(mat1$x,mat1$y,mat1$z,col="green"
>>>> , shade=TRUE,theta=s*5
>>>> , xlab="",ylab="",zlab="",zlim=c(0,7))
>>>> 
>>>> 
>>>> I get this error
>>>> 
>>>> Error in s * 5 : non-numeric argument to binary operator
>>>> 
>>>> Can anyone help?
>>> The error message looks perfectly sensible:  there is no numeric object
>>> named 's'.
>>> 
>>> --
>>> David
>>>> 
>>>> I have R 3.0.1
>>>> windows 8
>>>> 
>>>> Thanks in advance
>>>> 
>>>>   [[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.
> 
>    [[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.



More information about the R-help mailing list