paulandpen at optusnet.com.au
2007-Aug-07 06:24 UTC
[R] bayesm - question about 'rscaleUsage function'
Hi all, I have managed to get the r-scale usage algorithm to work, but I need to obtain the final results from this. As I understand it, this code is designed to generate a matrix after processing and store it somewhere????? Here is the code..... 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???? I want to extract the matrix in its complete form and save this as a file for further processing. What I want to get is..... V1 V2 V3 V4 V1 1.47 0.99 1.14 1.56 V2 1.67 0.93 1.35 1.21 If I type 'out' see below in the GUI interface I get the following:>out[,1288] [,1289] [,1290] [,1291] ....... [3,] 1.47 0.99 1.14 1.56 ........ [4,] 1.17 0.96 0.63 1.32 ........ [5,] 1.65 0.51 0.39 1.62 .......>summary(out)Length Class Mode Sigmadraw 500 bayesm.var numeric mudraw 50 bayesm.mat numeric taudraw 9055 bayesm.mat numeric sigmadraw 9055 bayesm.mat numeric Lambdadraw 20 bayesm.mat numeric edraw 5 bayesm.mat numeric Thanks Paul
<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
Maybe Matching Threads
- Problems with Z in rhierMnlRwMixture using bayesm
- problem using mcmcsamp() with glmer models containing interaction terms in fixed effects
- Survey Design / Rake questions
- bug in functions of form "mcpar<-"
- mcmcsamp shortening variable names; how can i turn this feature off?