Re: [R] For loops

2012-04-11 Thread Clemontina Alexander
This has nothing to do with your question, but instead of using class=c(rep(1,3),rep(2,3),rep(3,3)) It's probably easier to use class = rep(1:3, each =3) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Data Manipulation - make diagonal matrix of each element of a matrix

2011-12-16 Thread Clemontina Alexander
Thank you, that is much simpler! On Thu, Dec 15, 2011 at 2:04 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, I believe I can help, or at least, my code is simpler. First, look at your first line: idd - length(diag(1,tt))   # length of intercept matrix # not needed: diag(tt) would

[R] Data Manipulation - make diagonal matrix of each element of a matrix

2011-12-15 Thread Clemontina Alexander
*numco) for(i in 1:numco){ X[,((i-1)*tt+1):(i*tt)] - matrix( c(matrix(rep(diag(1,tt),n),ncol=tt, byrow=TRUE)) * rep(rep(x[,i],each=tt),tt) , ncol=tt) } X It works fine, but is there an easier way when n, tt, and numco get larger and larger? Thanks, Tina -- Clemontina

Re: [R] Data Manipulation - make diagonal matrix of each element of a matrix

2011-12-15 Thread Clemontina Alexander
. Tina On Thu, Dec 15, 2011 at 10:02 AM, Clemontina Alexander ckale...@ncsu.edu wrote: Dear R list, I have the following data: set.seed(1) n  - 5     # number of subjects tt - 3     # number of repeated observation per subject numco - 2  # number of covariates x - matrix(round(rnorm(n

[R] Very simple question about list components

2011-09-09 Thread Clemontina Alexander
I have a list 'ans' from the following code: tt - rnorm(50) rr - rnorm(50) ans - lm(rr~tt) ans[1] is $coefficients, ans[2] is $residuals, ans[3] is $effects, ... and so on up to ans[12]. Is there an easy way to display just these names and not the data they contain? I thought I saw my advisor

Re: [R] Very simple question about list components

2011-09-09 Thread Clemontina Alexander
Lianoglou mailinglist.honey...@gmail.com wrote: Hi Clemontina, On Fri, Sep 9, 2011 at 11:01 AM, Clemontina Alexander ckale...@ncsu.edu wrote: I have a list 'ans' from the following code: tt - rnorm(50) rr - rnorm(50) ans - lm(rr~tt) ans[1] is $coefficients, ans[2] is $residuals, ans[3

Re: [R] Re; Getting SNPS from PLINK to R

2011-06-21 Thread Clemontina Alexander
Hi, If you go to this site: http://pngu.mgh.harvard.edu/~purcell/plink/res.shtml#teach And download the teaching.zip file, I think there was information in the word document about reading plink data into R, though I am not 100% sure. I think a read.table(filename.ped, header=T) command may be

Re: [R] anyone using LARS package in R

2011-05-26 Thread Clemontina Alexander
I have used lars before. I could not find a tutorial, so finally asked a professor at my school. He has a wrapper that nicely prints out all the variables that were selected and is more stable in cross validation than the original package. See below for the code and description.

Re: [R] Lasso with Categorical Variables

2011-05-03 Thread Clemontina Alexander
Lianoglou wrote: Hi, On Mon, May 2, 2011 at 12:45 PM, Clemontina Alexander ckale...@ncsu.edu wrote: Hi! This is my first time posting. I've read the general rules and guidelines, but please bear with me if I make some fatal error in posting. Anyway, I have a continuous response and 29 predictors

[R] Lasso with Categorical Variables

2011-05-02 Thread Clemontina Alexander
Hi! This is my first time posting. I've read the general rules and guidelines, but please bear with me if I make some fatal error in posting. Anyway, I have a continuous response and 29 predictors made up of continuous variables and nominal and ordinal categorical variables. I'd like to do lasso

Re: [R] Lasso with Categorical Variables

2011-05-02 Thread Clemontina Alexander
for levels A and B, but not C and D, does this mean that X1 should be included in the model? Thanks. On Mon, May 2, 2011 at 2:47 PM, David Winsemius dwinsem...@comcast.net wrote: On May 2, 2011, at 10:51 AM, Steve Lianoglou wrote: Hi, On Mon, May 2, 2011 at 12:45 PM, Clemontina Alexander ckale