Running examples in ‘iprior-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: iprior
> ### Title: Fit an I-prior regression model
> ### Aliases: iprior iprior.default iprior.formula iprior.ipriorKernel
> ###   iprior.ipriorMod
> 
> ### ** Examples
> 
> 
> # Formula based input
> (mod.stackf <- iprior(stack.loss ~ Air.Flow + Water.Temp + Acid.Conc.,
+                       data = stackloss))
iter   10 value 28.570084
iter   20 value 28.174418
final  value 28.173955 
converged
Log-likelihood value: -56.34793 

lambda[1] lambda[2] lambda[3]       psi 
  0.04081   0.22251  -0.01228   0.10575 
> mod.toothf <- iprior(len ~ supp * dose, data = ToothGrowth)
iter   10 value 87.261916
final  value 87.144321 
converged
> summary(mod.toothf)
Call:
iprior(formula = len ~ supp * dose, data = ToothGrowth)

RKHS used:
Pearson (supp)
Linear (dose)

Residuals:
   Min. 1st Qu.  Median 3rd Qu.    Max. 
-8.3508 -3.1864 -0.0713  2.1799  8.2117 

Hyperparameters:
          Estimate    S.E.      z P[|Z>z|]  
lambda[1]   0.6347  0.3755  1.690    0.091 .
lambda[2]  -6.0081  3.1130 -1.930    0.054 .
psi         0.0618  0.1864  0.331    0.740  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Direct optimisation method. Iterations: 18/100 
Converged to within 1e-08 tolerance. Time taken: 0.5378518 secs
Log-likelihood value: -174.2887 
RMSE of prediction: 3.955925 (Training)
> 
> # Non-formula based input
> mod.stacknf <- iprior(y = stackloss$stack.loss,
+                       Air.Flow = stackloss$Air.Flow,
+                       Water.Temp = stackloss$Water.Temp,
+                       Acid.Conc. = stackloss$Acid.Conc.)
iter   10 value 28.289724
iter   20 value 28.175779
final  value 28.173955 
converged
> mod.toothnf <- iprior(y = ToothGrowth$len, ToothGrowth$supp, ToothGrowth$dose,
+                       interactions = "1:2")
iter   10 value 87.151418
final  value 87.144321 
converged
> 
> # Formula based model option one.lam = TRUE
> # Sets a single scale parameter for all variables
> modf <- iprior(stack.loss ~ ., data = stackloss, one.lam = TRUE)
iter   10 value 30.006795
final  value 30.006573 
converged
> modnf <- iprior(y = stackloss$stack.loss, X = stackloss[1:3])
iter   10 value 30.006930
final  value 30.006573 
converged
> all.equal(coef(modnf), coef(modnf))  # both models are equivalent
[1] TRUE
> 
> # Fit models using different kernels
> dat <- gen_smooth(n = 100)
> mod <- iprior(y ~ X, dat, kernel = "fbm")  # Hurst = 0.5 (default)
final  value 115.242901 
converged
> mod <- iprior(y ~ X, dat, kernel = "poly3")  # polynomial degree 3
final  value 137.644184 
converged
> 
> # Fit models using various estimation methods
> mod1 <- iprior(y ~ X, dat)
iter   10 value 136.921774
final  value 136.267590 
converged
> mod2 <- iprior(y ~ X, dat, method = "em")
========================================
Converged after 50 iterations.
> mod3 <- iprior(y ~ X, dat, method = "canonical")
final  value 136.267590 
converged
> mod4 <- iprior(y ~ X, dat, method = "mixed")
Running 5 initial EM iterations
================================================================================
Now switching to direct optimisation
iter   10 value 136.267590
final  value 136.267590 
converged
> mod5 <- iprior(y ~ X, dat, method = "fixed", lambda = coef(mod1)[1],
+                psi = coef(mod1)[2])
> all.equal(logLik(mod1), logLik(mod2), logLik(mod3), logLik(mod4),
+           logLik(mod5), tol = 1e-6)
Error in all.equal.numeric(logLik(mod1), logLik(mod2), logLik(mod3), logLik(mod4),  : 
  all(scale > 0) is not TRUE
Calls: all.equal -> all.equal.numeric -> stopifnot
Execution halted