Running ‘emTests.R’
Running the tests in ‘tests/emTests.R’ failed.
Complete output:
  > library(norm2)
  > 
  > ## run EM on fake data with no missing values
  > set.seed(1234)
  > simdata <- data.frame(
  +    Y1=rnorm(6), Y2=rnorm(6), Y3=rnorm(6), X1=rnorm(6) )
  > emResult <- emNorm( cbind(Y1,Y2,Y3) ~ X1, data=simdata )
  > print( summary( emResult ) )
  Predictor (X) variables:
                   Mean       SD Observed Missing Pct.Missing
  (Intercept) 1.0000000 0.000000        6       0           0
  X1          0.2068512 1.178512        6       0           0
  
  Response (Y) variables:
           Mean        SD Observed Missing Pct.Missing
  Y1 -0.2092854 1.2953550        6       0           0
  Y2 -0.6752401 0.2138685        6       0           0
  Y3 -0.2141319 0.6864124        6       0           0
  
  Missingness patterns for response (Y) variables
     (. denotes observed value, m denotes missing value)
     (variable names are displayed vertically)
     (rightmost column is the frequency):
  YYY
  123
  ... 6
  
  Method:                             EM
  Prior:                              "uniform"
  Convergence criterion:              1e-05
  Iterations:                         2
  Converged:                          TRUE
  Max. rel. difference:               0
  -2 Loglikelihood:                   -8.3665
  -2 Log-posterior density:           -8.3665
  Worst fraction missing information: 0
  
  Estimated coefficients (beta):
                      Y1         Y2         Y3
  (Intercept) -0.3069981 -0.6785479 -0.2457194
  X1           0.4723816  0.0159912  0.1527063
  
  Estimated covariance matrix (sigma):
             Y1         Y2         Y3
  Y1 1.14001811 0.06789367 0.13397509
  Y2 0.06789367 0.03782049 0.03942553
  Y3 0.13397509 0.03942553 0.36564511
  > 
  > ## impose missing values and run again
  > simdata$Y1[3] <- simdata$Y2[4] <- simdata$Y3[4] <- NA
  > emResult <- emNorm( cbind(Y1,Y2,Y3) ~ X1, data=simdata )
  > print( summary( emResult ) )
  Predictor (X) variables:
                   Mean       SD Observed Missing Pct.Missing
  (Intercept) 1.0000000 0.000000        6       0           0
  X1          0.2068512 1.178512        6       0           0
  
  Response (Y) variables:
           Mean        SD Observed Missing Pct.Missing
  Y1 -0.4680307 1.2630567        5       1    16.66667
  Y2 -0.6322806 0.2081665        5       1    16.66667
  Y3 -0.2349012 0.7653216        5       1    16.66667
  
  Missingness patterns for response (Y) variables
     (. denotes observed value, m denotes missing value)
     (variable names are displayed vertically)
     (rightmost column is the frequency):
  YYY
  123
  ... 4
  .mm 1
  m.. 1
  
  Method:                             EM
  Prior:                              "uniform"
  Convergence criterion:              1e-05
  Iterations:                         114
  Converged:                          TRUE
  Max. rel. difference:               9.8836e-06
  -2 Loglikelihood:                   -10.70465
  -2 Log-posterior density:           -10.70465
  Worst fraction missing information: 0.9313
  
  Estimated coefficients (beta):
                      Y1          Y2         Y3
  (Intercept) -1.0195738 -0.61863204 -0.1874030
  X1           0.5166042 -0.01611584  0.1214564
  
  Estimated covariance matrix (sigma):
              Y1          Y2          Y3
  Y1  1.80844106 -0.06800034 -0.75502100
  Y2 -0.06800034  0.03443290  0.05759078
  Y3 -0.75502100  0.05759078  0.41668488
  > 
  > ## redundant Y-variable
  > simdata$Y3 <- simdata$Y1 + simdata$Y2
  > emResult <- emNorm( cbind(Y1,Y2,Y3) ~ X1, data=simdata )
  
   *** caught segfault ***
  address 0, cause 'memory not mapped'
  
  Traceback:
   1: .Fortran("norm_em", n = nrow(y), r = ncol(y), p = ncol(x), x = x,     y = y, mvcode = mvcode, prior.type.int = prior.type.int,     prior.df = prior.df, prior.sscp = prior.sscp, iter.max = iter.max,     criterion = criterion, estimate.worst = estimate.worst, startval.present = startval.present,     iter = integer(1), converged = logical(1), rel.diff = numeric(1),     loglik = numeric(iter.max), logpost = numeric(iter.max),     beta = beta, sigma = sigma, y.imp = y, npatt = integer(1),     mis = matrix(logical(1), nrow(y), ncol(y)), n.in.patt = integer(nrow(y)),     n.obs = integer(ncol(y)), which.patt = integer(nrow(y)),     ybar = numeric(ncol(y)), ysdv = numeric(ncol(y)), rate.beta = beta,     rate.sigma = sigma, em.worst.ok = logical(1), worst.frac = numeric(1),     nparam = nparam, worst.linear.coef = numeric(nparam), status = integer(1),     msg.len.max = msg.len.max, msg.codes = msg.codes, msg.len.actual = integer(1),     PACKAGE = "norm2")
   2: emNorm.default(y, x = x, intercept = FALSE, iter.max = iter.max,     criterion = criterion, estimate.worst = estimate.worst, starting.values = starting.values,     prior = prior, prior.df = prior.df, prior.sscp = prior.sscp,     ...)
   3: emNorm.formula(cbind(Y1, Y2, Y3) ~ X1, data = simdata)
   4: emNorm(cbind(Y1, Y2, Y3) ~ X1, data = simdata)
  An irrecoverable exception occurred. R is aborting now ...