[R] bayesm - question about 'rscaleUsage function'

Dieter Menne dieter.menne at menne-biomed.de
Tue Aug 7 08:48:18 CEST 2007


 <paulandpen <at> optusnet.com.au> writes:

 
> I get this part of the code, it all makes sense.
> 
> ##
> if(nchar(Sys.getenv("LONG_TEST")) != 0) {R=1000} else {R=5} 
> {
> data(customerSat)
> surveydat = list(k=10,x=as.matrix(customerSat))
> Mcmc1 = list(R=R)
> set.seed(66)
> out=rscaleUsage(Data=surveydat,Mcmc=Mcmc1)
> summary(out$mudraw)
> }
> 
> My question is how do I retrieve the results from this in a matrix format????
> 

str() is your friend...

-----
if(nchar(Sys.getenv("LONG_TEST")) != 0) {R=1000} else {R=5} 
{
data(customerSat)
surveydat = list(k=10,x=as.matrix(customerSat))
Mcmc1 = list(R=R)
set.seed(66)
out=rscaleUsage(Data=surveydat,Mcmc=Mcmc1)
summary(out$mudraw)
}
> str(out)

List of 6
 $ Sigmadraw : bayesm.var [1:5, 1:100] 7.37 7.04 5.56 5.00 4.50 ...
  ..- attr(*, "class")= chr [1:3] "bayesm.var" "bayesm.mat" "mcmc"
  ..- attr(*, "mcpar")= num [1:3] 1 5 1
 $ mudraw    : bayesm.mat [1:5, 1:10] 6.21 6.54 6.49 6.56 6.59 ...
  ..- attr(*, "class")= chr [1:2] "bayesm.mat" "mcmc"
  ..- attr(*, "mcpar")= num [1:3] 1 5 1
 $ taudraw   : bayesm.mat [1:5, 1:1811]  0.1862 -1.4988 -1.0348  0.0754  1.0258 ...
  ..- attr(*, "class")= chr [1:2] "bayesm.mat" "mcmc"
  ..- attr(*, "mcpar")= num [1:3] 1 5 1
 $ sigmadraw : bayesm.mat [1:5, 1:1811] 1.11 1.29 1.47 1.2 1.95 0.72 0.63 0.69
1.2 1.14 ...
  ..- attr(*, "class")= chr [1:2] "bayesm.mat" "mcmc"
  ..- attr(*, "mcpar")= num [1:3] 1 5 1
 $ Lambdadraw: bayesm.mat [1:5, 1:4] 3.35 2.73 2.58 2.49 2.73 ...
  ..- attr(*, "class")= chr [1:2] "bayesm.mat" "mcmc"
  ..- attr(*, "mcpar")= num [1:3] 1 5 1
 $ edraw     :Classes 'bayesm.mat', 'mcmc'  atomic [1:5] 0.000 0.001 0.001 0.001
0.001
  .. ..- attr(*, "mcpar")= num [1:3] 1 5 1
> 
Looks like you want sigmadraw (lowercase!)? So try

out$sigmadraw

Dieter



More information about the R-help mailing list