* using log directory ‘/data/blackswan/ripley/R/packages/tests-devel/simml.Rcheck’
* using R Under development (unstable) (2025-03-15 r87978)
* using platform: x86_64-pc-linux-gnu
* R was compiled by
    gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)
    GNU Fortran (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)
* running under: Fedora Linux 40 (Workstation Edition)
* using session charset: UTF-8
* checking for file ‘simml/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘simml’ version ‘0.3.0’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* 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 ‘simml’ can be installed ... [10s/10s] OK
* checking package directory ... 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 ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... 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 ... [15s/16s] OK
* checking Rd files ... 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 examples ... [12s/13s] OK
* checking examples with --run-donttest ... [12s/12s] ERROR
Running examples in ‘simml-Ex.R’ failed
The error most likely occurred in:

> ### Name: simml
> ### Title: Single-index models with multiple-links (main function)
> ### Aliases: simml
> 
> ### ** Examples
> 
> 
> 
> family <- "gaussian"   #"poisson"
> delta = 1              # moderate main effect
> s=2                    # if s=2 (s=1), a nonlinear (linear) contrast function
> n=500                  # number of subjects
> p=10                   # number of pretreatment covariates
> 
> # generate training data
> data <- generate.data(n= n, p=p, delta = delta, s= s, family = family)
> data$SNR  # the ratio of interactions("signal") vs. main effects("noise")
[1] 1.034872
> A <- data$A
> y <- data$y
> X <- data$X
> 
> # generate testing data
> data.test <- generate.data(n=10^5, p=p, delta = delta,  s= s, family = family)
> A.test <- data.test$A
> y.test <- data.test$y
> X.test <- data.test$X
> data.test$value.opt     # the optimal "value"
[1] 0.3153715
> 
> 
> # fit SIMML
> #1) SIMML without X main effect
> simml.obj1 <- simml(y, A, X, family = family)
iter: 2   difference in beta:  0.04372073 
iter: 3   difference in beta:  0.001728601 
> 
> #2) SIMML with X main effect (estimation efficiency for the g term of SIMML can be improved)
> simml.obj2 <- simml(y, A, X, Xm = X, family = family)
iter: 2   difference in beta:  0.03941395 
iter: 3   difference in beta:  0.002889698 
> 
> 
> # apply the estimated SIMML to the testing set and obtain treatment assignment rules.
> simml.trt.rule1 <- pred.simml(simml.obj1, newX= X.test)$trt.rule
> # "value" estimation (estimated by IPWE)
> simml.value1 <-  mean(y.test[simml.trt.rule1 == A.test])
> simml.value1
[1] 0.3023963
> 
> simml.trt.rule2 <- pred.simml(simml.obj2, newX= X.test)$trt.rule
> simml.value2 <-  mean(y.test[simml.trt.rule2 == A.test])
> simml.value2
[1] 0.3060042
> 
> # compare these to the optimal "value"
> data.test$value.opt
[1] 0.3153715
> 
> 
> 
> # fit MC (modified covariates) model of Tien et al 2014
> n.A <- summary(as.factor(A)); pi.A <- n.A/sum(n.A)
> mc  <- (as.numeric(A) + pi.A[1] -2) *cbind(1, X)  # 0.5*(-1)^as.numeric(A) *cbind(1, X)
> mc.coef  <-  coef(glm(y ~ mc, family =  family))
> mc.trt.rule <- (cbind(1, X.test) %*% mc.coef[-1] > 0) +1
> # "value" estimation (estimated by IPWE)
> mc.value  <-  mean(y.test[mc.trt.rule == A.test])
> mc.value
[1] 0.1544669
> 
> 
> # visualization of the estimated link functions of SIMML
> simml.obj1$beta.coef        # estimated single-index coefficients
     X1      X2      X3      X4      X5      X6      X7      X8      X9     X10 
 0.8189  0.4990  0.2588  0.0810  0.0553 -0.0438 -0.0207  0.0133 -0.0038  0.0359 
> g.fit <- simml.obj1$g.fit   # estimated trt-specific link functions; "g.fit" is a mgcv::gam object.
> #plot(g.fit)
> 
> ## No test: 
> # can improve visualization by using the package "mgcViz"
> #install.packages("mgcViz")
> # mgcViz depends on "rgl". "rgl" depends on XQuartz, which you can download from xquartz.org
> #library(mgcViz)
> # transform the "mgcv::gam" object to a "mgcViz" object (to improve visualization)
> g.fit <- getViz(g.fit)
Error in getViz(g.fit) : could not find function "getViz"
Execution halted
* checking PDF version of manual ... OK
* checking for non-standard things in the check directory ... OK
* checking for detritus in the temp directory ... OK
* checking for new files in some other directories ... OK
* DONE

Status: 1 ERROR
See
  ‘/data/blackswan/ripley/R/packages/tests-devel/simml.Rcheck/00check.log’
for details.

Command exited with non-zero status 1
Time 2:14.68, 100.02 + 27.02