[R] RE

Spencer Graves spencer.graves at pdf.com
Wed Aug 9 10:22:45 CEST 2006


	  I've never used the 'bayesm' package, but your question sounded 
interesting and I've not seen a reply, so I decided to look at it. 
Unfortunately, I couldn't make sense of your example in the time 
available.  Instead, I will offer a few more general questions / 
suggests that I hope might help you.

	  1.  Have you worked through the example in the 'rmnlIndepMetrop' help 
file?

	  2.  Have you worked through the documentation in 
'~library\basesm\doc' subdirectory of your installed version of R?

	  3.  Have you tried the web site for the companion book, cited in the 
'References' to the 'rmnlIndepMetrop' help file?

	  If you've tried all these things and you would still like help from 
this listserve, I suggest you submit another post that is more 
consistent with the suggestions in the posting guide 
'www.R-project.org/posting-guide.html'.  This includes (a) using an 
informative subject (b) including the email address of the maintainer 
for the 'bayesm' package, listed in help(package='bayesm') in the 
distribution, and (c) providing commented, minimal, self-contained, 
reproducible code.

	  The example you provided was helpful be inadequate for someone like 
me to diagnose the problem in a reasonable period of time.  I suggest 
you include a call to 'set.seed' before your random number generation, 
and including attempted function calls to 'llmnl' and 'rmnlIndepMetrop' 
with comments explaining your confusion.

	  I know this doesn't answer your question, but I hope it helps.
	  Spencer Graves

nmi13 wrote:
> Hi any,
> 
> Can some please detail me the createX command in bayesm package?
> 
> To make things easy for you to help me, let me put forward my problem
> 
> Suppose I have 3 covariates (say X matrix) and my Y has 3 categories say 
> (1,2,3). Now from the CreateX I understand that the data matrix say 'Xa' must 
> be of dimension n* (naxp), where 'na' is the number of variables and 'p' is 
> the number of categories that Y has and 'n' is the number of observations. Now 
> the Xa matrix will have 9 columns if I give na=3 and p=3, and 6 columns if I 
> give na =2 and p=3. I understand this part. In order to create Xa with a 
> dimension of n*9 or n*6 we have to create Xa as cbind(Xa,-Xa) and now when I 
> get the design matrix say XD then I have 5 or 4 variables, which will be same 
> as the beta matrix that  I intend to get, I get this, but my question is when 
> I get the XD matrix as explained below the covariate matrix (X) which 
> initially had  3 columns now changed to a  9 rows and one column and two 
> additional variables X4 and X5 as explained belwo which I guess for the beta, 
> what is the role of these variables in the 'rmnlIndepMetrop'analysis.
> example
> x1<-runif(3,-1,1)
> x2<-runif(3,0,1)
> x3<-runif(3,10,50)
> X<-cbind(x1,x2,x3)
> X
>              x1        x2       x3
> [1,] -0.9701396 0.4084203 41.31097
> [2,]  0.3844539 0.4791997 36.85861
> [3,]  0.2732056 0.5433642 13.14610
> 
> Xa<-cbind(X,-X)
> XD<-createX(p=3,na=2,nd=NULL,Xa=Xa,Xd=NULL)
> XD
>       [,1] [,2]       [,3]        [,4]
>  [1,]    1    0 -0.9701396   0.9701396
>  [2,]    0    1  0.4084203  -0.4084203
>  [3,]    0    0 41.3109655 -41.3109655
>  [4,]    1    0  0.3844539  -0.3844539
>  [5,]    0    1  0.4791997  -0.4791997
>  [6,]    0    0 36.8586070 -36.8586070
>  [7,]    1    0  0.2732056  -0.2732056
>  [8,]    0    1  0.5433642  -0.5433642
>  [9,]    0    0 13.1461040 -13.1461040
> Xa<-cbind(X,-X,X^2) (is this a correct way)
> XD<-createX(p=3,na=3,nd=NULL,Xa=Xa,Xd=NULL)
> XD
>       [,1] [,2]       [,3]        [,4]         [,5]
>  [1,]    1    0 -0.9701396   0.9701396    0.9411709
>  [2,]    0    1  0.4084203  -0.4084203    0.1668071
>  [3,]    0    0 41.3109655 -41.3109655 1706.5958746
>  [4,]    1    0  0.3844539  -0.3844539    0.1478048
>  [5,]    0    1  0.4791997  -0.4791997    0.2296324
>  [6,]    0    0 36.8586070 -36.8586070 1358.5569127
>  [7,]    1    0  0.2732056  -0.2732056    0.0746413
>  [8,]    0    1  0.5433642  -0.5433642    0.2952447
>  [9,]    0    0 13.1461040 -13.1461040  172.8200512
> 
> In the above example my X matrix as you can see has 3 columns with 3 
> observations, which now in XD are 9 observations in 3rd column, I don't know 
> how col 4 and col 5 of XD play a role in computing the llmnl and 
> rmnlIndepMetrop.
> 
> Thanks for all your help and time.
> 
> Regards,
> Murthy.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list