* using log directory 'd:/Rcompile/CRANpkg/local/3.0/BayesSummaryStatLM.Rcheck' * using R version 3.0.3 (2014-03-06) * using platform: i386-w64-mingw32 (32-bit) * using session charset: ISO8859-1 * checking for file 'BayesSummaryStatLM/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'BayesSummaryStatLM' version '1.0' * 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 hidden files and directories ... OK * checking for portable file names ... OK * checking whether package 'BayesSummaryStatLM' can be installed ... OK * checking installed package size ... 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 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 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 ... OK * 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 ... OK * checking contents of 'data' directory ... OK * checking data for non-ASCII characters ... OK * checking data for ASCII and uncompressed saves ... OK * checking examples ... ERROR Running examples in 'BayesSummaryStatLM-Ex.R' failed The error most likely occurred in: > ### Name: bayes.regress > ### Title: MCMC posterior sampling of Bayesian linear regression model > ### parameters using only summary statistics > ### Aliases: bayes.regress > ### Keywords: combine consensus subposterior posterior parallel > > ### ** Examples > > ################################################## > ## Simulate data > ################################################## > > set.seed(284698) > > num.samp <- 100 # number of data values to simulate > > # The first value of the beta vector is the y-intercept: > beta <- c(-0.33, 0.78, -0.29, 0.47, -1.25) > > # Calculate the number of predictor variables: > num.pred <- length(beta)-1 > > rho <- 0.0 # correlation between predictors > mean.vec <- rep(0,num.pred) > sigma.mat <- matrix(rho,num.pred,num.pred) + diag(1-rho,num.pred) > sigmasq.sim <- 0.05 > > # Simulate predictor variables: > x.pre <- rmvn(num.samp, mu=mean.vec, sigma=sigma.mat) > > # Add leading column of 1's to x.pre for y-intercept: > x <- cbind(rep(1,num.samp),x.pre) > > epsilon <- rnorm(num.samp, mean=0, sd=sqrt(sigmasq.sim)) > > y <- as.numeric( x %*% as.matrix(beta) + epsilon) > > ## Compute summary statistics (alternatively, the > # "read.regress.data.ff() function (in this package) can be > # used to calculate summary statistics; see example below). > > xtx <- t(x)%*%x > xty <- t(x)%*%y > yty <- t(y)%*%y > > data.values<-list(xtx=xtx, xty=xty, yty=yty, + numsamp.data = num.samp, + xtx.inv = chol2inv(chol(xtx))) > > ########################################################## > ## Bayesian linear regression analysis > ########################################################## > > Tsamp.out <- 100 # number of MCMC samples to produce > > ## Choose priors for beta and sigma-squared. Here, > # beta: Uniform prior; sigma-squared: Inverse Gamma prior. > > beta.prior <- list( type = "flat") > sigmasq.prior <- list(type = "inverse.gamma", inverse.gamma.a = 1.0, + inverse.gamma.b = 1.0, sigmasq.init = 1.0 ) > > set.seed(284698) > > # Run the "bayes.regress" function using the data simulated above. > > MCMC.out <- bayes.regress(data.values, + beta.prior, + sigmasq.prior = sigmasq.prior, + Tsamp.out = Tsamp.out) > > # Next, print the posterior means of the unknown model parameters. > # Alternatively, the "coda" package can be used for analysis. > > print(c(colMeans(MCMC.out$beta), mean(MCMC.out$sigmasq))) [1] -0.31718660 0.77275199 -0.27380379 0.52685576 -1.22473866 0.07465078 > > # Check that output is close to simulated values (although num.samp and > # Tsamp.out are small here); note that the output includes both beta and > # sigmasq: > # c(-0.33, 0.78, -0.29, 0.47, -1.25, 0.05) > > ## Run all 6 combinations of priors for 3 "beta.prior" choices and > # 2 "sigmasq.prior" choices: > > beta.priors <- list( + list( type = "flat"), + + list( type = "mvnorm.known", + mean.mu = rep(0.0, (num.pred+1)), + prec.Cinv = diag(1.0, (num.pred+1))), + + list( type = "mvnorm.unknown", + mu.hyper.mean.eta = rep(0.0,(num.pred+1)), + mu.hyper.prec.Dinv = diag(1.0, (num.pred+1)), + Cinv.hyper.df.lambda = (num.pred+1), + Cinv.hyper.invscale.Vinv = diag(1.0, (num.pred+1)), + mu.init = rep(1.0, (num.pred+1)), + Cinv.init = diag(1.0,(num.pred+1))) + ) > > sigmasq.priors <- list( + list(type = "inverse.gamma", + inverse.gamma.a = 1.0, + inverse.gamma.b = 1.0, + sigmasq.init = 0.1 ), + list( type="sigmasq.inverse", sigmasq.init = 0.1) + ) > > for (beta.prior in beta.priors) + { + for(sigmasq.prior in sigmasq.priors) + { + set.seed(284698) + MCMC.out <- bayes.regress(data.values, + beta.prior, + sigmasq.prior = sigmasq.prior, + Tsamp.out = Tsamp.out) + print(c(colMeans(MCMC.out$beta), mean(MCMC.out$sigmasq))) + } + } [1] -0.31754170 0.77234799 -0.27435855 0.52767691 -1.22488276 0.07436599 [1] -0.31789780 0.77237323 -0.27497950 0.52769906 -1.22532299 0.05490155 [1] -0.31711481 0.77187886 -0.27426407 0.52739342 -1.22429838 0.07437203 [1] -0.31758096 0.77202514 -0.27490930 0.52748880 -1.22488935 0.05490578 [1] -0.31480149 0.77445508 -0.28014614 0.53223970 -1.22722827 0.07401473 [1] -0.31559684 0.77421916 -0.27994271 0.53161283 -1.22739629 0.05464019 > > # Check that output is close to simulated values (although num.samp and > # Tsamp.out are small here); note that the output includes both beta and > # sigmasq: > # c(-0.33, 0.78, -0.29, 0.47, -1.25, 0.05): > > > ####################################################################### > ## Read the data from a file, calculate the summary statistics and run > ## the Bayesian linear regression analysis > ####################################################################### > > Tsamp.out <- 100 > > ## Assume non-zero y-intercept data. > > # Read the files and compute summary statistics using the "read.regress.data.ff()" > # function (in this package). > > > filename <- system.file('data/regressiondata.nz.all.csv.gz', package='BayesSummaryStatLM') > data.values <- read.regress.data.ff(filename) Error in read.table.ffdf(file = fname, , fileEncoding = fileEncoding, : unkown arguments: numerals,skipNul Calls: read.regress.data.ff -> read.table.ffdf Execution halted