Hi all

 

I have been doing series of linear regression models lm(). In this case the 
execution time and memory usage becomes a huge issue. I have therefore been 
trying to speed the process and limit the memory usage. 

 

Here follows part of the code do give better understanding of what I am doing:

 

modela <- lm(RSSYS10 ~ RS_AGE + RS_AGESQ + SEX + RS_BMI)

frssys <- function(SNP_A1,data=sys_pheno, model=modela){

            modelb <- lm(RSSYS10 ~ RS_AGE + RS_AGESQ + SEX + RS_BMI + 
SNP_A1,data=data)

modelc <- lm(RSSYS10 ~ RS_AGESQ + SEX + RS_BMI + SNP_A1 * RS_AGE,data=data)

p1 <- anova(model,modelb)$P[2] 

p2 <- anova(model,modelc)$P[2] 

p3 <- anova(modelb,modelc)$P[2]           

}

result_matrix <- apply(mldose_asmatrix[,2:ncol(mldose_asmatrix)],2,frssys)

 

Data frame sys_pheno has all variables except SNP_A1. In matrix mldose_asmatrix 
is a series of variables (columns), which are called SNP_A1 in the function 
frssys. Matrix mldose_asmatrix is very big with up to 50 000 columns and it 
happens that R runs out of memory. 

 

Does anyone have an idea how I can save memory and/or speed up the process?

 

Regards,

Gauti Gislason

 








http://www.hjarta.is/index.aspx?GroupId=411, veist þú þína áhættu ?
http://www.hjarta.is/um-hjartavernd/postlist,
--------------------------------------------------------------------------
Þessi tölvupóstur og viðhengi gæti innihaldið trúnaðarupplýsingar 
og/eða einkamál og er eingöngu ætlaður þeim sem hann er stílaður á.
Efni hans og innihald er á ábyrgðþess starfsmanns sem sendir hann ef það 
tengist ekki starfsemi Hjartaverndar
Ef sending þessi hefur ranglega borist yður vinsamlega gætið fyllsta 
trúnaðar,tilkynnið sendanda og eyðileggið sendinguna eins og skylt er skv. 
5. mgr. 47. gr. laga um fjarskipti nr. 81/2003 um fjarskipti.

The information transmitted, including any attachment, may contain confidential 
and/or privileged material and is intended only for the 
addressee only. The contents of the message are the individual senders 
responsibility if it is not related to the operation of Hjartavernd
If you receive this in error, please keep the information confidential, contact 
the sender and delete the material from your system. 

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to