[R] Zero mean correlation Matrix

2008-10-20 Thread AliR

Hi,,

I want to use the existing cor function in R but with a different way to
compute the correlation method.. basically zero mean correlation. 

The forumula I have is 

'D' - function(c1, c2)
  sum(c1*c2, na.rm=T)/(sqrt(sum(c1*c1, na.rm=T))*sqrt(sum(c2*c2, na.rm=T)))


I am not sure how i can modify the method cor computes its square roots and
covariance matrixes? I only need to add this to get the answer 
   


-- 
View this message in context: 
http://www.nabble.com/Zero-mean-correlation-Matrix-tp20074044p20074044.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


Re: [R] Applying lm to data with combn

2008-02-09 Thread AliR

Thank you, can you suggest wht is the shortest way to store the combination
with min residual error term?



AliR wrote:
 
  http://www.nabble.com/file/p15359204/test.data.csv 
 http://www.nabble.com/file/p15359204/test.data.csv test.data.csv 
 
 Hi, 
 
 I have used apply to have certian combinations, but when I try to use
 these combinations I get the error 
 [Error in eval(expr, envir, enclos) : object X.GDAXI not found]. being a
 novice I donot understand that after applying combination to the data I
 cant access it and use lm on these combinations. The data frame either is
 no longer a matrix, how can I access the data and make it work for lm!!
 
 Any help please!
 
 
 
 
 
 
 fruit  = read.csv(file=test.data.csv,head= TRUE, sep=,)# read it in
 matrix format
 
 #fruit =read.file(row.names=1)$data
 
 mD =head(fruit[, 1:5])# only first five used in combinations
 #X.SSMII = head(fruit[,  6])# Keep it for referebce
 nmax = NULL
 n =  ncol(mD)# dont take the last column for reference purpose
 if(is.null(nmax)) nmax = n
 
 mDD = apply(combn(5, 1),1, FUN= function(y) mD[, y])# to
 
 
 
 fg = lm( X.SSMII ~ X.GDAXI +  X.FTSE +  X.FCHI + X.IBEX, data = mDD )#
 regress on combos
 
 s = cbind(s, Residuals = residuals(fg))# take residuals
 
 print(mD)
 
 

-- 
View this message in context: 
http://www.nabble.com/Applying-lm-to-data-with-combn-tp15359204p15391159.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


[R] Applying lm to data with combn

2008-02-08 Thread AliR

http://www.nabble.com/file/p15359204/test.data.csv 
http://www.nabble.com/file/p15359204/test.data.csv test.data.csv 

Hi, 

I have used apply to have certian combinations, but when I try to use these
combinations I get the error 
[Error in eval(expr, envir, enclos) : object X.GDAXI not found]. being a
novice I donot understand that after applying combination to the data I cant
access it and use lm on these combinations. The data frame either is no
longer a matrix, how can I access the data and make it work for lm!!

Any help please!






fruit  = read.csv(file=test.data.csv,head= TRUE, sep=,)# read it in
matrix format

#fruit =read.file(row.names=1)$data

mD =head(fruit[, 1:5])# only first five used in combinations
#X.SSMII = head(fruit[,  6])# Keep it for referebce
nmax = NULL
n =  ncol(mD)# dont take the last column for reference purpose
if(is.null(nmax)) nmax = n

mDD = apply(combn(5, 1),1, FUN= function(y) mD[, y])# to



fg = lm( X.SSMII ~ X.GDAXI +  X.FTSE +  X.FCHI + X.IBEX, data = mDD )#
regress on combos

s = cbind(s, Residuals = residuals(fg))# take residuals

print(mD)

-- 
View this message in context: 
http://www.nabble.com/Applying-lm-to-data-with-combn-tp15359204p15359204.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.