Analyse_shLoF_KvsTADA.R

AJWillsey — Mar 18, 2013, 3:56 PM

###AJ Willsey, March 18 2013
##Script: Analyse_shLoF_KvsTADA.R (same location as setwd)

setwd("~/Dropbox/SSC_July_2012/Co-expression/coexp_paper_Nov-12/Paper_Network_files")
mydata=read.table("TADA_vs_K.txt", sep="\t", head=T)
mydata=na.omit(mydata)
mynewdata=cbind(mydata, qnorm(mydata[,4], lower.tail=F))

##Fit linear model to predict Z as a function of K
#periods3-5 in Frontal Cortex, all pTADA.LoF results
summary(lm(formula = mynewdata[,5] ~ mynewdata[,2]))

Call:
lm(formula = mynewdata[, 5] ~ mynewdata[, 2])

Residuals:
   Min     1Q Median     3Q    Max 
-3.143 -1.193  0.249  1.347  2.625 

Coefficients:
               Estimate Std. Error t value Pr(>|t|)   
(Intercept)      1.2235     0.4384    2.79   0.0062 **
mynewdata[, 2]   0.0238     0.0233    1.02   0.3080   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Residual standard error: 1.46 on 111 degrees of freedom
Multiple R-squared: 0.00936,    Adjusted R-squared: 0.000436 
F-statistic: 1.05 on 1 and 111 DF,  p-value: 0.308 
#periods13-15 in Frontal Cortex, all pTADA.LoF results
summary(lm(formula = mynewdata[,5] ~ mynewdata[,3]))

Call:
lm(formula = mynewdata[, 5] ~ mynewdata[, 3])

Residuals:
   Min     1Q Median     3Q    Max 
-3.229 -1.127  0.225  1.309  2.521 

Coefficients:
               Estimate Std. Error t value Pr(>|t|)    
(Intercept)     1.53538    0.44577    3.44  0.00081 ***
mynewdata[, 3]  0.00741    0.02745    0.27  0.78763    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Residual standard error: 1.47 on 111 degrees of freedom
Multiple R-squared: 0.000656,   Adjusted R-squared: -0.00835 
F-statistic: 0.0729 on 1 and 111 DF,  p-value: 0.788 
#periods3-5 in Frontal Cortex, only pTADA.LoF <=0.01
summary(lm(formula = mynewdata[,5][mynewdata[,4]<=0.01] ~ mynewdata[,2][mynewdata[,4]<=0.01]))

Call:
lm(formula = mynewdata[, 5][mynewdata[, 4] <= 0.01] ~ mynewdata[, 
    2][mynewdata[, 4] <= 0.01])

Residuals:
    Min      1Q  Median      3Q     Max 
-0.6924 -0.1497 -0.0332  0.1338  1.0478 

Coefficients:
                                       Estimate Std. Error t value
(Intercept)                             3.19228    0.14385   22.19
mynewdata[, 2][mynewdata[, 4] <= 0.01] -0.00694    0.00733   -0.95
                                       Pr(>|t|)    
(Intercept)                              <2e-16 ***
mynewdata[, 2][mynewdata[, 4] <= 0.01]     0.35    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Residual standard error: 0.322 on 48 degrees of freedom
Multiple R-squared: 0.0184, Adjusted R-squared: -0.0021 
F-statistic: 0.897 on 1 and 48 DF,  p-value: 0.348 
#periods13-15 in Frontal Cortex, only pTADA.LoF <=0.01
summary(lm(formula = mynewdata[,5][mynewdata[,4]<=0.01] ~ mynewdata[,3][mynewdata[,4]<=0.01]))

Call:
lm(formula = mynewdata[, 5][mynewdata[, 4] <= 0.01] ~ mynewdata[, 
    3][mynewdata[, 4] <= 0.01])

Residuals:
    Min      1Q  Median      3Q     Max 
-0.6853 -0.1574 -0.0679  0.1370  1.0859 

Coefficients:
                                       Estimate Std. Error t value
(Intercept)                             3.07706    0.13479   22.83
mynewdata[, 3][mynewdata[, 4] <= 0.01] -0.00087    0.00786   -0.11
                                       Pr(>|t|)    
(Intercept)                              <2e-16 ***
mynewdata[, 3][mynewdata[, 4] <= 0.01]     0.91    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Residual standard error: 0.325 on 48 degrees of freedom
Multiple R-squared: 0.000255,   Adjusted R-squared: -0.0206 
F-statistic: 0.0123 on 1 and 48 DF,  p-value: 0.912 

#plot periods3-5 in Frontal Cortex, all pTADA.LoF results
t=summary(lm(formula = mynewdata[,5] ~ mynewdata[,2]))
plot(formula = mynewdata[,5] ~ mynewdata[,2], main="Periods 3-5 in Frontal Cortex", xlab="Sum of Connectivity with all network nodes", ylab="PTADA LoF", pch=19, col="blue")
abline(a=c(t$coefficients[1], t$coefficients[2]))
mtext(paste("Adjusted R-squared: ", signif(t$adj.r.squared, digits=2), ", p-value: 0.31", sep=""), side=3)

plot of chunk unnamed-chunk-1