Re: [R] Summary statistics for matrix columns

2012-11-24 Thread frespider
> Sd=sd(x), > "3rd Qu" = quantile(x,0.75,names=FALSE), > IQR=IQR(x), > Max = max(x))) }) > # user system elapsed > # 0.384 0.000 0.384 > > > A.K.

Re: [R] Summary statistics for matrix columns

2012-11-22 Thread frespider
Hi, it is possible. but don't you think it will slow the code if you convert to data.frame? Thanks Date: Thu, 22 Nov 2012 18:31:35 -0800 From: ml-node+s789695n4650500...@n4.nabble.com To: frespi...@hotmail.com Subject: RE: Summary statistics for matrix columns HI, Is it possible t

Re: [R] Summary statistics for matrix columns

2012-11-22 Thread frespider
HI, but Sd and IQR not in the order I want , Thanks Date: Thu, 22 Nov 2012 18:08:57 -0800 From: ml-node+s789695n4650496...@n4.nabble.com To: frespi...@hotmail.com Subject: RE: Summary statistics for matrix columns Hi, How about this: res<-do.call(cbind,lapply(split(x,col(x)),funct

Re: [R] Summary statistics for matrix columns

2012-11-22 Thread frespider
There is still missing some statistics, like sd and IQR and I prefer the output to be matrix Thanks Date: Thu, 22 Nov 2012 18:00:20 -0800 From: ml-node+s789695n4650493...@n4.nabble.com To: frespi...@hotmail.com Subject: Re: Summary statistics for matrix columns HI, You could try t

Re: [R] Summary statistics for matrix columns

2012-11-22 Thread frespider
Hi peter, but this doesn't give me them in the order I want. Is there a better approach Thanks -- View this message in context: http://r.789695.n4.nabble.com/Summary-statistics-for-matrix-columns-tp4650489p4650492.html Sent from the R help mailing list archive at Nabble.com. _

[R] Summary statistics for matrix columns

2012-11-22 Thread frespider
Hi, is there a way I can calculate a summary statistics for a columns matrix let say we have this matrix x <- matrix(sample(1:8000),nrow=100) colnames(x)<- paste("Col",1:ncol(x),sep="") if I used summary summary(x) i get the output for each column but I need the output to be in matrix with r

Re: [R] Summary statistics for matrix columns

2012-11-22 Thread frespider
I also don't like to use split function because I have like around 800 columns Date: Thu, 22 Nov 2012 18:08:54 -0800 From: ml-node+s789695n4650496...@n4.nabble.com To: frespi...@hotmail.com Subject: RE: Summary statistics for matrix columns Hi, How about this: res<-do.call(cbind,lapply(split(

Re: [R] Remove Column from matrix

2012-11-21 Thread frespider
Hi, I edited the code sorry, I forgot the line before Can you have look again please? Thanks -- View this message in context: http://r.789695.n4.nabble.com/Remove-Column-from-matrix-tp4650334p4650348.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Remove Column from matrix

2012-11-21 Thread frespider
Hi,, Can I get help with this. I need to remove a column form the matrix if that specific column has his all entry zero, here the code I wrote but it is not working can you help me please namVar <- c("TrlgWSST","TrlgWSSE","TrlgWSSR","SSdiff","TrlgWMSE","TrlgWR2","TrlgWR2adj","TrlgSSE","TrlgMSE","T

Re: [R] R-Square in WLS

2012-11-19 Thread frespider
: > On Fri, Nov 16, 2012 at 4:48 PM, frespider <[hidden email]> wrote: > >> Hi, >> >> I am fitting a weighted least square regression and trying to compute >> SSE,SST and SSReg but I am not getting SST = SSReg + SSE and I dont know >> w

Re: [R] R-Square in WLS

2012-11-18 Thread frespider
To: frespi...@hotmail.com Subject: Re: R-Square in WLS On Fri, Nov 16, 2012 at 4:48 PM, frespider <[hidden email]> wrote: > Hi, > > I am fitting a weighted least square regression and trying to compute > SSE,SST and SSReg but I am not getting SST = SSReg + SSE and I

Re: [R] Multiple Vector with matrix in R

2012-11-16 Thread frespider
Hi No i didn't get error it executed too fast, I had question about the Sum squares in the weighted least square if u can help me I would I appreciated Thanks Date: Fri, 16 Nov 2012 09:46:59 -0800 From: ml-node+s789695n4649775...@n4.nabble.com To: frespi...@hotmail.com Subject: Re: Multiple

Re: [R] Multiple Vector with matrix in R

2012-11-16 Thread frespider
Hi A.K Here is the error I get when I use %*% > dim(X) [1] 71142 219 > length(Weights) [1] 71142 > Wx<-diag(Weights)%*%X Error in array(0, c(n, p)) : 'dim' specifies too large an array That is why I asked for different and faster method -- View this message in context: http://r.789695.n4.na

[R] Multiple Vector with matrix in R

2012-11-16 Thread frespider
Hi Can someone show me an easy way to multiple a weighted vector with an matrix? example below mat1<-matrix(sample(1:100,80,replace=TRUE),ncol=8) w <- 1/1:10 I want the first element in w to be multiplied by the first row of mat1 and 2nd element in w to be multiplied with the 2nd row and so on.

[R] R-Square in WLS

2012-11-15 Thread frespider
Hi, I am fitting a weighted least square regression and trying to compute SSE,SST and SSReg but I am not getting SST = SSReg + SSE and I dont know what I am coding wrong. Can you help please? xnam <-colnames(X) # colnames Design Matrix

Re: [R] Calling R object from R function

2012-11-08 Thread frespider
Hi, I edit my post, Can you please help with this matter? Hi, Can you please help me with this please? What I am trying to do is call a vector from R function and used in the new function # Initialize some data Dat <- cbind( a0 = rep(1, 40), a = rep(0:1, 20), b = rep(c(1,0), each =

[R] Calling R object from R function

2012-11-07 Thread frespider
Hi, Can you please help me with this please? What I am trying to do is call a vector from R function and used in the new function So I create 4 functions with these arguments M11 <- function(TrainData,TestData,mdat,nsam) { ls <- list() I have few statments one of them is vectx <- c(,1,2,3,4,5,

[R] GLM and WLS

2012-11-05 Thread frespider
Hi I am running some simulation in R after resampling from a huge data set 500 columns and 86759 rows and fit these two model and calculate R-square fit <- lm(Y~X,weights = Weights) bhat <- coef(fit) Yhat <- X%*%bhat SST <- sum((Y - mean(Y))^2) SSE <- sum(

Re: [R] Saving R Graph to a file

2012-11-04 Thread frespider
> necessary after drawing the image for pdf(). The name for the file > argument (file="c:/figure.xxx") is file not filename > > hist(CO2[,5]) is more interesting > > And yes, > ?pdf > ?postscript ?png > > On 11/3/2012 11:16 PM, frespider wrote: >&g

[R] Saving R Graph to a file

2012-11-04 Thread frespider
Hi I am not sure why I can't get my plot saved to a file as .ps, I searched online and I found that I have to use something is called postscript,png or pdf function which I did but still not working. Actually what I have is a matrix with almost 300-400 columns. I need to create a histogram and bo

Re: [R] Return Vector Component

2012-11-01 Thread frespider
Hi A.K. Thank you so much for replying this could work but the problem you recreate the newv1, to match v2 but I don't want to do that. I just want to check if v2 has that component from v1 THanks Date: Thu, 1 Nov 2012 06:32:03 -0700 From: ml-node+s789695n4648123...@n4.nabble.com To: frespi

[R] Return Vector Component

2012-11-01 Thread frespider
Hi, I am new R user and I am still learn this fabulous software. I am stuck on this part. I need to check 2 character vectors v1 <- c("age_1","age_2","age_3","age_4","age_5","age_6","height_1","height_2","height_3","height_4","height_5","height_6","height_7","height_8") and v2 <- c("sex_1","s