- using R Under development (unstable) (2025-03-29 r88074)
- using platform: x86_64-pc-linux-gnu
- R was compiled by
gcc-14 (Debian 14.2.0-19) 14.2.0
GNU Fortran (Debian 14.2.0-19) 14.2.0
- running under: Debian GNU/Linux trixie/sid
- using session charset: UTF-8
- checking for file ‘cgam/DESCRIPTION’ ... OK
- checking extension type ... Package
- this is package ‘cgam’ version ‘1.23’
- checking package namespace information ... OK
- checking package dependencies ... INFO
Depends: includes the non-default packages:
'coneproj', 'svDialogs', 'statmod', 'lme4', 'Matrix', 'splines2'
Adding so many packages to the search path is excessive and importing
selectively is preferable.
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking whether package ‘cgam’ can be installed ... OK
See the install log for details.
- checking package directory ... OK
- checking for future file timestamps ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking code files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... [2s/2s] OK
- checking whether the package can be loaded with stated dependencies ... [2s/2s] OK
- checking whether the package can be unloaded cleanly ... [2s/2s] OK
- checking whether the namespace can be loaded with stated dependencies ... [2s/2s] OK
- checking whether the namespace can be unloaded cleanly ... [2s/2s] OK
- checking loading without being on the library search path ... [2s/2s] OK
- checking use of S3 registration ... OK
- checking 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 ... [44s/53s] OK
- checking Rd files ... [0s/1s] OK
- checking Rd metadata ... OK
- checking Rd line widths ... 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 ... OK
- checking contents of ‘data’ directory ... OK
- checking data for non-ASCII characters ... [0s/0s] OK
- checking data for ASCII and uncompressed saves ... OK
- checking examples ... [2s/3s] ERROR
Running examples in ‘cgam-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: cgam
> ### Title: Constrained Generalized Additive Model Fitting
> ### Aliases: cgam
> ### Keywords: cgam routine
>
> ### ** Examples
>
> # Example 1.
> data(cubic)
> # extract x
> x <- cubic$x
>
> # extract y
> y <- cubic$y
>
> # regress y on x with no restriction with lm()
> fit.lm <- lm(y ~ x + I(x^2) + I(x^3))
>
> # regress y on x under the restriction: "increasing and convex"
> fit.cgam <- cgam(y ~ incr.conv(x))
>
> # make a plot to compare the two fits
> par(mar = c(4, 4, 1, 1))
> plot(x, y, cex = .7, xlab = "x", ylab = "y")
> lines(x, fit.cgam$muhat, col = 2, lty = 2)
> lines(x, fitted(fit.lm), col = 1, lty = 1)
> legend("topleft", bty = "n", c("constrained cgam fit", "unconstrained lm fit"),
+ lty = c(2, 1), col = c(2, 1))
>
> # Example 2.
> ## Not run:
> ##D library(gam)
> ##D data(kyphosis)
> ##D
> ##D # regress Kyphosis on Age, Number, and Start under the restrictions:
> ##D # "concave", "increasing and concave", and "decreasing and concave"
> ##D fit <- cgam(Kyphosis ~ conc(Age) + incr.conc(Number) + decr.conc(Start),
> ##D family = binomial(), data = kyphosis)
> ## End(Not run)
>
> # Example 3.
> library(MASS)
> data(Rubber)
>
> # regress loss on hard and tens under the restrictions:
> # "decreasing" and "decreasing"
> fit.cgam <- cgam(loss ~ decr(hard) + decr(tens), data = Rubber)
> # "smooth and decreasing" and "smooth and decreasing"
> fit.cgam.s <- cgam(loss ~ s.decr(hard) + s.decr(tens), data = Rubber)
> summary(fit.cgam.s)
Call:
cgam(formula = loss ~ s.decr(hard) + s.decr(tens), data = Rubber)
Coefficients:
Estimate StdErr t.value p.value
(Intercept) 175.4333 5.9624 29.423 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for gaussian family taken to be 606.8062)
Null deviance: 225011.4 on 29 degrees of freedom
Residual deviance: 17597.38 on 16.5 observed degrees of freedom
Approximate significance of constrained components:
edf mixture.of.Beta p.value
s.decr(hard) 7.5 0.8772 < 2.2e-16 ***
s.decr(tens) 4.5 0.8166 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
CIC: 10.0851> anova(fit.cgam.s)
Family: gaussian
Link function: identity
Formula:
cgam(formula = loss ~ s.decr(hard) + s.decr(tens), data = Rubber)
Approximate significance of smooth terms:
edf mixture.of.Beta p.value
s.decr(hard) 7.5 0.8772 < 2.2e-16 ***
s.decr(tens) 4.5 0.8166 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> # make a 3D plot based on fit.cgam and fit.cgam.s
> plotpersp(fit.cgam, th = 120, main = "3D Plot of a Cgam Fit")
> plotpersp(fit.cgam.s, tens, hard, data = Rubber, th = 120, main = "3D Plot of a Smooth Cgam Fit")
>
> # Example 4. monotonic variance estimation
> n <- 400
> x <- runif(n)
> sig <- .1 + exp(15*x-8)/(1+exp(15*x-8))
> e <- rnorm(n)
> mu <- 10*x^2
> y <- mu + sig*e
>
> fit <- cgam(y ~ s.incr.conv(x), var.est = s.incr(x))
> est.var <- fit$vh
> muhat <- fit$muhat
>
> par(mfrow = c(1, 2))
> plot(x, y)
> points(sort(x), muhat[order(x)], type = "l", lwd = 2, col = 2)
> lines(sort(x), (mu)[order(x)], col = 4)
>
> plot(sort(x), est.var[order(x)], col=2, lwd=2, type="l",
+ lty=2, ylab="Variance", ylim=c(0, max(c(est.var, sig^2))))
> points(sort(x), (sig^2)[order(x)], col=1, lwd=2, type="l")
>
> # Example 5. monotonic variance estimation with the lidar data set in SemiPar
> library(SemiPar)
> data(lidar)
>
> fit <- cgam(logratio ~ s.decr(range), var.est=s.incr(range), data=lidar)
Error in attr(x, "nm") <- deparse(pars$x) :
cannot set attribute on a 'builtin'
Calls: cgam -> cgam.fit -> s.incr
Execution halted
- checking PDF version of manual ... [6s/8s] OK
- checking HTML version of manual ... [2s/2s] OK
- checking for non-standard things in the check directory ... OK
- DONE
Status: 1 ERROR