- using R version 2.15.0 (2012-03-30)
- using platform: i686-pc-linux-gnu (32-bit)
- using session charset: UTF-8
- checking for file ‘gbev/DESCRIPTION’ ... OK
- this is package ‘gbev’ version ‘0.1.1’
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... NOTE
As from R 2.14.0 all packages need a namespace.
One will be generated on installation, but it is better to handcraft a
NAMESPACE file: R CMD build will produce a suitable starting point.
CRAN requires a NAMESPACE file for all submissions.
- checking for executable files ... OK
- checking whether package ‘gbev’ can be installed ... OK
- checking installed package size ... OK
- checking package directory ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking R files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... OK
- checking whether the package can be loaded with stated dependencies ... OK
- checking whether the package can be unloaded cleanly ... OK
- checking for unstated dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... NOTE
File ‘gbev/R/gbev.R’:
.First.lib calls:
require(mvtnorm)
Package startup functions should not change the search path.
See section ‘Good practice’ in ?.onAttach.
gbev: warning in match.call(expand = FALSE): partial argument match of
'expand' to 'expand.dots'
gbev: no visible binding for global variable ‘response’
gbev: no visible binding for global variable ‘var.names’
part.dep: no visible binding for global variable ‘fit’
- checking Rd files ... OK
- checking Rd metadata ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... WARNING
‘library’ or ‘require’ call not declared from: ‘lattice’
- checking line endings in C/C++/Fortran sources/headers ... OK
- checking line endings in Makefiles ... OK
- checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
- checking compiled code ... OK
- checking examples ... ERROR
Running examples in ‘gbev-Ex.R’ failed
The error most likely occurred in:
> ### Name: gbev
> ### Title: Boosted regression trees with errors-in-variables
> ### Aliases: gbev
> ### Keywords: nonparametric tree
>
> ### ** Examples
>
>
> ### Univariate regression example
> n<-500
> varX<-1
> varME<-0.25
> varNoise<-0.3^2
>
> ### Data
> x<-rnorm(n,sd=sqrt(varX)) ### Error free covariate
> w<-x+rnorm(n,sd=sqrt(varME)) ### Error contaminated version
> fx<-sin(pi*x/2)/(1+2*(x^2)*((2*as.numeric(x>=0)-1)+1)) ### True regression function
> y<-fx+rnorm(n,sd=sqrt(varNoise)) ### Response
> dat<-data.frame(y=y,w=w)
>
> ### Measurement error model ####
> ###
> ### The measurement error model is a list of the following components:
> ###
> ### SigmaX: the covariance matrices of the mixture model for the error free covariates
> ### SigmaX[i,,] is the covariance matrix of the i-th mixture density
> ### mu: the means of the mixture model for the error free covariates
> ### mu[i,] is the mean-vector of the i-th mixture density
> ### SigmaME: the covariance matrix of the measurment error
> ### pComp: the weights of the mixture distribution, pComp[i] is the weight of the
> ### i-th mixture density
> ### numComp: the number of components in the mixture
> ##
> p<-1
> pME<-1
>
> numComp<-3 ## number of components in gaussian mixture for X-distribution
> SigmaME<-diag(varME,pME)
> SigmaJ<-array(dim=c(numComp,pME,pME))
> mu<-array(dim=c(numComp,pME))
> pComp<-array(1/numComp,dim=c(numComp,1))
> for(i in 1:numComp)
+ {
+ SigmaJ[i,,]<-diag(varX,pME)
+ mu[i,]<-rep(0,pME)
+ }
> ### list required by "gbev" for measurement error model
> meModel<-list(SigmaX=SigmaJ,mu=mu,SigmaME=SigmaME,pComp=pComp,numComp=numComp)
>
>
> fit<-gbev(y~w,data=dat,
+ measErrorModel=meModel,
+ method="L2", ## Squared error loss
+ nboost=1000, ## 1000 boosting iterations
+ lambda=5, ## regularization of regression tree
+ maxDepth=2, ## maximum tree depth, 2 corresponds stumps
+ mc=2, ## number of monte-carlo samples per tree build
+ minSplit=3, ## minimum number of obs in node to split
+ minBucket=0, ## minimum number of obs in nodes
+ sPoints=10, ## number of sampled candidate split points
+ intermPred=5) ## increments of iterations to store predictions
>
> ### 5-fold cross-validation
> hcv<-cvLoss(object=fit,k=5,random=FALSE,loss="L2")
> plot(hcv$iters,hcv$cvLoss,type="l")
>
> hp<-part.dep(object=fit,varIndx=1,firstTree=1,lastTree=hcv$estIter)
>
> x<-seq(-2,2,by=.02)
> fx<-sin(pi*x/2)/(1+2*(x^2)*((2*as.numeric(x>=0)-1)+1))
> points(x,fx,type="l",lty=5)
>
>
>
>
> ## Simulated binary regression example,
> ## with: Y=I( X1*X2+X2*X3+X1*X3>0), with measurement error on X's
> n<-1000
> p<-3
> varX<-1 ##
> varME<-0.5 ## measurement error variance
>
> x<-rnorm(p*n)
> x<-matrix(x,ncol=p,nrow=n)
> ## add measurement error
> w<-x+matrix(rnorm(p*n,sd=sqrt(varME)),ncol=p,nrow=n)
>
> x<-x[,c(1:p)]*x[,c(2:p,1)]
> x<-apply(x,1,sum)
> threshold<-0
> y<-as.numeric(x>threshold)
> dat<-data.frame(y=y,w1=w[,1],w2=w[,2],w3=w[,3]) ## must be modified if(p!=3)
>
>
> #### Measurement error model ######
> numComp<-1 ## Number of components in mixture
> SigmaME<-diag(varME,p) ## Covariance matrix of measurement error
> SigmaJ<-array(dim=c(numComp,p,p)) ## Covariance matices for mixture
> mu<-array(dim=c(numComp,p)) ## Mean vectors for mixture components
> pComp<-array(1/numComp,dim=c(numComp,1)) ## Mixture probabilities
> for(i in 1:numComp)
+ { ## filling in mixture model for X-distribution
+ SigmaJ[i,,]<-diag(varX,p)
+ mu[i,]<-rep(0,p)
+ }
> ## The list for measurement error model
> meModel<-list(SigmaX=SigmaJ,mu=mu,SigmaME=SigmaME,pComp=pComp,numComp=numComp)
>
> fit<-gbev(y~w1+w2+w3,data=dat,
+ measErrorModel=meModel,
+ method="logLike", ## loss function
+ nboost=1000, ## number of boosting iterations
+ lambda=40, ## regularization parameter used in regression tree
+ maxDepth=3, ## maximum depth of regression tree
+ minSplit=10, ## minimum number of observations in node to split
+ minBucket=0, ## minimum number in split node to allow split
+ sPoints=2, ## number of sampled canditate split points
+ mc=2, ## monte-carlo sample size used in each regression tree
+ intermPred=10) ## Increments of iterations to store loss function
>
>
> ## plot loss function as function of iterations
> hp<-plotLoss(fit,loss="logLike",startIter=10)
>
> ## bivariate partial dependence plot
> hdp<-part.dep(object=fit,varIndx=c(1,2),firstTree=1,
+ lastTree=1000,ngrid=50)
> dpp<-data.frame(x1=hdp$dat$x,x2=hdp$dat$y,prob=hdp$dat$z)
> library(lattice)
Error in library(lattice) : there is no package called ‘lattice’
Execution halted