[R] how to delete some columns from a matrix based on some other indicator variable

2006-09-20 Thread Ya-Hsiu Chuang
Hello, I am not very familiar with R and need help in deleting a few columns in a matrix. Suppose I have a indicator variable called r and it's defined as r = (0, 0, 1, 1). A matrix D is a 3X4 matrix. If I want a new matrix which contains only the columns of D corresponding to the elements of

[R] how to generate matrices based on an indicator variable

2006-10-04 Thread Ya-Hsiu Chuang
Hi, I am trying to create matrices X's based on one indicator variable, r. Given a 4 x4 matrix X= [ 0,0,0,0 0,0,0,0 0,0,0,0 0,0,0,1] r= c(0, 0, 0, 1) I'd like to create separat

[R] matrix multiplication

2006-10-05 Thread Ya-Hsiu Chuang
Dear all, I have 2 matrices, one is a 8x3 matrix, called X; the other matrix is a 3x3 indicator matrix with the diagonal element as 0 or 1. when a variable is included in the model, the corresponding diagonal element is 1, otherwise, it is 0. Let A be a set of matrices that contain the possibl