# 2013 Dec 10, use layout and mar() to do layered plots (not overlays)
#YPS163 2011April 13, plot
rm=(list=ls())
setwd("~/github/LOH_H2O2_2012-master/figures")
debug = 0;
FileList = list.files( path="../data.H2O2-LOH/", pattern="YPS163"); FileList;
filename = 'YPS163,Apr13,2011.H2O2.LOH.csv';
fullFileName = paste('../data.H2O2-LOH/',filename, sep='');
mylabel = 'YPS163 20110413'
tb = read.csv(fullFileName, colClasses=c("character",NA, NA, "character", rep("numeric",8 ), NA));
names(tb) = c("Strain", "OD600", "Dilution","Date","H2O2stock", "White", "Black", "halfBlack", "quarterBlack", "ThreeQBlack", "QQBlack", "Other", "Notes")
######## set zeros
mycolumns = c("White","Black","halfBlack", "quarterBlack","ThreeQBlack", "QQBlack", "Other");
for( i in 1:length(tb[,1])) {
for ( j in mycolumns) {
if( is.na(tb[i,j]) ) { tb[i,j]= 0 }
}
}
#adjust for low-counts
tb$Black[tb$Black<=0] = 0.5
tb$halfBlack[tb$halfBlack<=0] = 0.5
tb$Black[tb$Black<0]=NA; #remove weird experimental data, such as low-lead concentration effect
tb$H2O2 = tb$H2O2stock/2
tb$tot = tb$White + tb$Black + tb$halfBlack + tb$quarterBlack + tb$ThreeQBlack + tb$QQBlack + tb$Other
tb.ori = tb;
tb = tb[ ! is.na(tb$White), ]
tb$Dilution = tb$Dilution / tb$Dilution[1]
######## normalize all data
mycolumns = c("White","Black","halfBlack", "quarterBlack","ThreeQBlack", "QQBlack", "Other","tot");
for ( j in mycolumns) {
tb[,j] = tb[,j] * tb$Dilution
}
####### find out means, sd
H2O2 = sort(unique( tb$H2O2))
#s = H2O2
tbm = data.frame(cbind(H2O2))
for ( i in 1:length(H2O2)) {
c = H2O2[i]
tmp = tb[ tb$H2O2==c, ]
tbm$tot[i] = mean(tmp$tot, na.rm=T)
tbm$tot.sd[i] = sd(tmp$tot, na.rm=T)
tbm$White[i] = mean(tmp$White, na.rm=T)
tbm$Black[i] = mean(tmp$Black, na.rm=T)
tbm$Black.sd[i] = sd(tmp$Black, na.rm=T)
tbm$halfBlack[i] = mean(tmp$halfBlack, na.rm=T)
tbm$halfBlack.sd[i] = sd(tmp$halfBlack, na.rm=T)
tbm$quarterBlack[i] = mean(tmp$quarterBlack, na.rm=T)
tbm$ThreeQBlack[i] = mean(tmp$ThreeQBlack, na.rm=T)
tbm$QQBlack[i] = mean(tmp$QQBlack, na.rm=T);
}
tbm = tbm[tbm$tot>2, ] #remove plates with <2 colonies. At least 1 white and 1 black is needed.
###### some manual curations here
# ...
###### calculate fractions
tbf = tbm;
tbf$s = tbf$tot / max(tbf$tot)
for ( j in c("Black","halfBlack", "quarterBlack","ThreeQBlack","QQBlack")) {
tbf[, j] = tbf[,j] / tbf$tot
}
for ( j in c("tot.sd", "Black.sd","halfBlack.sd")) {
tbf[, j] = tbf[,j] / max(tbf$tot); #bug fixed, 2013 Dec 10, 18:50
tbf[, j] = ifelse(tbf[, j]<=1/700, 1/700, tbf[, j] ) #at least 0.2% error
}
head(tbf)
plot(tbf$tot.sd ~ tbf$H2O2)
#It is not clear whether color figures would be charged more or not by Aging Cell.
#### define functions
logistical.viability <- function( T, w, t ) { ret <- 1 /( 1 + ( t / T )^ w ); }
logistical.black <- function(b.max, b.min, T, w, t ) { ret <- b.max - (b.max - b.min) /( 1 + ( t / T )^ w ); }
# genome.integrity <- function(b.max, b.min, T, w, t) { 2 * (b.max - b.min) / (1 + (t/T)^w) + (1 - 2 * b.max); }
######## calclulate Cv, Cb
require(nlme)
t= tbf$H2O2; s= tbf$s; b = tbf$Black
model1 = function(v,w) { 1/( 1 + ( t / v )^ w ) }
fm.s <- gnls( s ~ model1(v,w) , start = list( v = 0.02, w=2) );
t2 = seq(0,1,by=0.001)
fit.s = logistical.viability ( fm.s$coefficients[1], fm.s$coefficients[2], t2 );
Cv = fm.s$coefficients[1]
#estimate starting values
b.tmp = sort( b[ b>0 ] );
b.min = sum(b.tmp[1])/1
b.tmp = rev(b.tmp);
b.max = sum(b.tmp[1:3])/3
modelBlack = function(v, w) { b.max - (b.max-b.min)/(1 + (t/v)^w) }
modelBlack1 = function(v) { b.max - (b.max-b.min)/(1 + (t/v)) }
#fm.b <- gnls( b ~ modelBlack1(v) , start = list( v = 0.05) );
fm.b <- gnls( b ~ modelBlack(v,w) , start = list( v = 0.005, w= 4 )); fm.b
fit.b = logistical.black(b.max, b.min, fm.b$coef[1], fm.b$coef[2], t2 )
Cb = fm.b$coef[1]
####################################################################
# do the plot
####################################################################
#### specificy the layout
#pdf(paste("_20131210", filename, "pdf", sep="."), width=6,height=9);
pdf(paste("_20131210", filename, "pdf", sep="."), width=5,height=8);
#tiff(paste("_20131210", filename, "tif", sep="."), width=240,height=500);
mat = matrix( seq(1,3), nrow=3, ncol= 1 );
layout(mat, heights= c( 1.15, 1, 1.2) );
### viability
par(mar=c(0,5,5,1))
plot( tbf$s ~ tbf$H2O2, col="blue", axes=F, xlab='', ylab='Viability', ylim=c(-0.1, 1.2), type='p', pch=19);
axis( 1, at = pretty(tbf$H2O2), labels=F, tcl=0.3);
axis( 2, at=pretty(tbf$s), tcl=0.2, las=2 )
lines( fit.s ~ t2, col="blue",lty=1);
#legend ( max(H2O2)*0.5, 0.5, c("viability","black", "half black"), col=c("blue","black"), lty=c(2,1), pch=c(1,16) )
arrows( tbf$H2O2, (tbf$s - tbf$tot.sd), tbf$H2O2, (tbf$s + tbf$tot.sd), length=0.1, angle=90,code=3, lty=2 );
#legend ( max(H2O2)*0.5, 0.5, c("viability"), col=c("blue"), lty=c(1), pch=c(16) )
points( Cv, 0.5, pch=15, col="red", cex=1.2 );
arrows( Cv, 0.5, Cv, -1, lty=2, col="red");
mtext( "Cv",side=1,at=c(Cv*0.85), line=-1, cex=0.8 );
box()
title(mylabel)
############ full blacks
par(mar=c(0,5,0,1))
plot( tbf$Black ~ tbf$H2O2, pch=16, xlab='',ylab="Black", log='y', ylim=c(0.8E-3, 0.15), axes=F)
axis( 2, at = c(0.001,0.01,0.05,0.1), labels=c(0.001,0.01,0.05,0.1), tcl=0.2, las=2);
axis( 1, at = pretty(tbf$H2O2), labels=F, tcl=0.3);
arrows( tbf$H2O2, (tbf$Black - tbf$Black.sd), tbf$H2O2, (tbf$Black + tbf$Black.sd), length=0.1, angle=90,code=3, lty=2 );
lines( fit.b ~ t2, lty=1, col='black');
points ( Cb, ( b.max/2 + b.min/2), pch=15, col="red", cex=1.2);
arrows( Cb, (b.max/2 + b.min/2), Cb, 1E-8, lty=2, col="red", length=0.1);
mtext( "Cb",side=1,at=c(Cb*1.2), line=-1, cex=0.8 );
box()
####################half black plots
#estimate starting values
b0.5 = tbf$halfBlack
# Do I need to adjust the dilution bias in [0.02,0.03]? No. Plot as is.
# b0.5[6:8] = b0.5[6:8] + 0.01
b0.5.tmp = sort( b0.5[ b0.5>0 ] );
b0.5.min = sum(b0.5.tmp[1])*1.3
b0.5.tmp = rev(b0.5.tmp);
b0.5.max = sum(b0.5.tmp[1])*1.05 #account for increasing trend
modelBlack0.5B = function(v) { b0.5.max - (b0.5.max-b0.5.min)/(1 + (t/v)^2) }
#fm.b0.5 <- gnls( b0.5 ~ modelBlack0.5B(v) , start = list( v = 0.05) ); fm.b0.5
#fit.b0.5 = logistical.black(b0.5.max, b0.5.min, fm.b0.5$coef[1], 2, t2 )
#logistical.black <- function(b.max, b.min, v, w, t ) { ret <- b.max - (b.max - b.min) /( 1 + ( t / T )^ w ); }
modelBlack0.5 = function(v, w) { b0.5.max - (b0.5.max-b0.5.min)/(1 + (t/v)^w) }
fm.b0.5 <- gnls( b0.5 ~ modelBlack0.5(v,w) , start = list( v = 0.008, w=1.5) ); fm.b0.5
fit.b0.5 = logistical.black(b0.5.max, b0.5.min, fm.b0.5$coef[1], fm.b0.5$coef[2], t2 )
#logistical.blackC <- function(b.max, b.min, v, w, u, t ) { ret <- b.max - (b.max - b.min) /( u + ( t / v )^ w ); }
#modelBlack0.5C = function(v, w, u) { b0.5.max - (b0.5.max-b0.5.min)/(u + (t/v)^w) }
#fm.b0.5 <- gnls( b0.5 ~ modelBlack0.5C(v,w,u) , start = list( v = 0.008, w=1.2, u=1.1) ); fm.b0.5
#fit.b0.5 = logistical.blackC(b0.5.max, b0.5.min, fm.b0.5$coef[1], fm.b0.5$coef[2], fm.b0.5$coef[3], t2 )
#plot(b0.5 ~ t )
#lines(fit.b0.5 ~ t2)
Cb0.5 = fm.b0.5$coef[1]
#par(new=T)
par(mar=c(5,5,0,1))
#plot( tbf$halfBlack ~ tbf$H2O2, pch=16, xlab='H2O2',ylab="half-black", col='red')
plot( b0.5 ~ t, pch=16, xlab='H2O2',ylab="Half-black", col='black', log='y', ylim=c(0.8E-3,0.15), axes=F)
axis( 1, at = pretty(t), labels=T, tcl=0.3);
#axis( 2, at = c(0.001,0.01,0.05,0.1), labels=T, tcl=0.2, las=2);
axis( 2, at = c(0.001,0.01,0.05,0.1), labels=c(0.001,0.01,0.05,0.1), tcl=0.2, las=2);
box()
lines(fit.b0.5 ~ t2, col='black')
arrows( tbf$H2O2, (tbf$halfBlack - tbf$halfBlack.sd), tbf$H2O2, (tbf$halfBlack + tbf$halfBlack.sd),
length=0.1, angle=90,code=3, lty=2, lwd=1 );
points ( Cb0.5, ( b0.5.max/2 + b0.5.min/2), pch=15, col="red", cex=1.2);
arrows( Cb0.5, (b0.5.max/2 + b0.5.min/2), Cb0.5, 1E-8, lty=2, col="red", length=0.1);
mtext( "Cb0.5",side=1,at=c(Cb*1.2),line=-1, cex=0.8 );
dev.off()
This site is to serve as my note-book and to effectively communicate with my students and collaborators. Every now and then, a blog may be of interest to other researchers or teachers. Views in this blog are my own. All rights of research results and findings on this blog are reserved. See also http://youtube.com/c/hongqin @hongqin
Tuesday, December 10, 2013
Rotated axis labels in R
axis( 2, at=pretty(tbf$s), tcl=0.2, las=2 )
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f
7.27 How can I create rotated axis labels?
To rotate axis labels (using base graphics), you need to use
text(), rather than mtext(), as the latter does not support par("srt").## Increase bottom margin to make room for rotated labels par(mar = c(7, 4, 4, 2) + 0.1) ## Create plot with no x axis and no x axis label plot(1 : 8, xaxt = "n", xlab = "") ## Set up x axis with tick marks alone axis(1, labels = FALSE) ## Create some text labels labels <- paste("Label", 1:8, sep = " ") ## Plot x axis labels at default tick marks text(1:8, par("usr")[3] - 0.25, srt = 45, adj = 1, labels = labels, xpd = TRUE) ## Plot x axis label at line 6 (of 7) mtext(1, text = "X Axis Label", line = 6)
When plotting the x axis labels, we use
srt = 45 for text rotation angle, adj = 1 to place the right end of text at the tick marks, and xpd = TRUE to allow for text outside the plot region. You can adjust the value of the 0.25 offset as required to move the axis labels up or down relative to the x axis. See ?par for more information.gnls error, approximate covariance matrix for parameter estimates not of full rank
fm.b0.5 <- gnls( b0.5 ~ modelBlack0.5(v,w) , start = list( v = 0.0075, w=0.5) );
Error in gnls(b0.5 ~ modelBlack0.5(v, w), start = list(v = 0.0075, w = 0.5)) :
approximate covariance matrix for parameter estimates not of full rank
Possible problem:
A typo in assignment that gave 'NA' bot b.05.max.
Ref:
http://en.wikipedia.org/wiki/Rank_%28linear_algebra%29
https://svn.r-project.org/R-packages/trunk/nlme/R/gnls.R
https://stat.ethz.ch/pipermail/r-help/2003-April/032550.html
Error in gnls(b0.5 ~ modelBlack0.5(v, w), start = list(v = 0.0075, w = 0.5)) :
approximate covariance matrix for parameter estimates not of full rank
Possible problem:
There's a symmetry in the model, probably due to dilution bias.
I manually corrected symmetry in the data, but still see the same error.
Further scrutinizing led the discovery of a typo.
Bug:
A typo in assignment that gave 'NA' bot b.05.max.
Ref:
http://en.wikipedia.org/wiki/Rank_%28linear_algebra%29
https://svn.r-project.org/R-packages/trunk/nlme/R/gnls.R
https://stat.ethz.ch/pipermail/r-help/2003-April/032550.html
Tools for network anlysis
cytoscape
clustering
NEAT
http://rsat.ulb.ac.be/index_neat.html
MCL
weka,
MATLAB
R igraph
elki
clustering
NEAT
http://rsat.ulb.ac.be/index_neat.html
MCL
weka,
MATLAB
R igraph
elki
Thursday, December 5, 2013
Summary of H2O2-LOH fitting, week of 2013 Dec 3-6
=>Dec4 I added fitting of half-black colonies, see _2c1.2013Dec4halfblack.batch.logistical.R
Comparing the auto fit and manual fit show that I need to run gnls with weights.
=>Dec5-6, I worked on gnls with weights, _2a2.2013Dec4.stepBystep.gnslWeights.R
(This file was changed to stepByStep, because the automated fitting is too tricky to handle).
To mitigate bias of low colony counts, zero black colonies were adjusted to 0.5, because the lower bound zero is too stringent, and the upper-bound 1 is not observed. A mid-point point between 0 and 1 can be considered as the expectation.
I tried to work on a generic batch fitting code, but the initial values are so hard to automated, I decided to choose the supervised fitting (manual fitting) process, and fit every experiment one by one. I can manually input the fitting results into a summary excel sheet in file, _merged.tb.20131204_3pm.csv
There are two ways to fit the model. One is to average each H2O2 concentration first. The other is fit directly to the raw data. The first approach is much more numerically stable. The second approach has better theoretic support but often run into run-time problems. The second approach some times give better fitting, but can also give totally unreasonable fitting. After spending long hours on the second approach, it seems that I have to fall back to the numerically more stable first approach.
It is apparent that some viability ~ H2O2 curves fit better with exp(-x*lambda), the exponential survival function. For example, M1-2.
In M2-8, 06062011, dilution bias can be seen in the plot.
* It seems that viability - H2O2 look like exponential in normal plot, but sigmoidal in s~log(H2O2) plot. What does this mean?
Sometimes, gnls can really burn cpu, which suggest initial values are too far away. This can happen during manual fitting process when I switch from one strain to another and their responses to H2O2 are drastically different.
20131206, 11:41: I noticed the log(s)~log(H2O2) linear curve in sod2, file sod2,20120918,H2O2LOH.csv . I need to do log-log plots in other strains to verify whether this is indeed due to sod2Delta effect. I realized that many more experiments are need to show this is true. I am not what this means. So, I will not discuss this in the current manuscript. However, this is sth that is potentially interesting.
20131206, 13:17. First round of fitting is done, results in file: _merged.tb.20131206_13,16pm.xlsx
There are some missing Cb0.5 due to running bugs.
20131206, 14:50. After calculating the skipped one, the final results are in file:
_merged.tb.20131206_14,49pm.xlsx.
Wednesday, December 4, 2013
Useful teaching websites
http://www.pedagogyunbound.com/
Educational videos, including MCAT and GRE trainings
http://education-portal.com/academy/course/gre-test.html?hq_e=el&hq_m=1641685&hq_l=14&hq_v=114280f8fb
http://www.shodor.org/featured/DiseaseModel/model/
Fitting with weights, gnls, weights and form, in R
gnls with weights (form)
http://stackoverflow.com/questions/10508474/step-halving-issue-in-gnlsnlme
dat:
Site_Code SF
5 3
5 0
5 2
5 0
5 0
5 0
library(nlme)
g0 <- gnls(SF ~ a * Site_Code^b, data = dat,
weights = varPower(form = ~Site_Code),
start=list(a=30,b=-0.5))
This example indicates that averaged data should NOT be used for regression if weights
are used. Instead, original data should be used, because the noises in the un-averaged
data can be used as weights.
The following example shows varPower() can bring the fitting model closer to 'truth'.
> require(nlme)
> x1 = rnorm(20)
> y1 = x1 + rnorm(20)/10
>
> #weird ones
> x2 = rnorm(5)+5
> y2 = rnorm(5)
>
> y=c(y1,y2)
> x=c(x1,x2)
> mydata = data.frame(cbind(y,x))
>
> foo = function(a,b) { y = x*a + b }
> model1 = gnls( y ~foo(a,b), start=list(a=1,b=0))
> summary(model1)
Generalized nonlinear least squares fit
Model: y ~ foo(a, b)
Data: NULL
AIC BIC logLik
72.21925 75.87587 -33.10962
Coefficients:
Value Std.Error t-value p-value
a -0.0159375 0.08311006 -0.1917637 0.8496
b -0.3550085 0.20216324 -1.7560486 0.0924
Correlation:
a
b -0.346
Standardized residuals:
Min Q1 Med Q3 Max
-1.8712584 -0.7939610 0.2684611 0.7910997 1.2959748
Residual standard error: 0.9485101
Degrees of freedom: 25 total; 23 residual
>
> model2 = gnls( y ~foo(a,b), data=mydata, start=list(a=1,b=0), weights=varPower(form = ~x))
> summary(model2)
Generalized nonlinear least squares fit
Model: y ~ foo(a, b)
Data: mydata
AIC BIC logLik
20.85874 25.73424 -6.429369
Variance function:
Structure: Power of variance covariate
Formula: ~x
Parameter estimates:
power
1.468287
Coefficients:
Value Std.Error t-value p-value
a 0.9281320 0.06104714 15.203530 0.0000
b -0.0255823 0.00891448 -2.869751 0.0087
Correlation:
a
b 0.17
Standardized residuals:
Min Q1 Med Q3 Max
-2.0273323 -0.8480791 -0.1211550 0.3073090 2.2141947
Residual standard error: 0.4204751
Degrees of freedom: 25 total; 23 residual
> model1
Generalized nonlinear least squares fit
Model: y ~ foo(a, b)
Data: NULL
Log-likelihood: -33.10962
Coefficients:
a b
-0.0159375 -0.3550085
Degrees of freedom: 25 total; 23 residual
Residual standard error: 0.9485101
> model2
Generalized nonlinear least squares fit
Model: y ~ foo(a, b)
Data: mydata
Log-likelihood: -6.429369
Coefficients:
a b
0.92813202 -0.02558234
Variance function:
Structure: Power of variance covariate
Formula: ~x
Parameter estimates:
power
1.468287
Degrees of freedom: 25 total; 23 residual
Residual standard error: 0.4204751
Monday, December 2, 2013
From Beamer to Powerpointer
I exported PDF into separate JPEGs, and then import into PPT.
A good discussion:
http://tex.stackexchange.com/questions/21986/export-beamer-slides-to-powerpoint-openoffice-impress-keynote-editable-format
Wednesday, November 27, 2013
Error propagation
http://www.fas.harvard.edu/~scphys/nsta/error_propagation.pdf
http://www.rit.edu/~w-uphysi/uncertainties/Uncertaintiespart2.html
Monday, November 25, 2013
Cb/Cv H2O2-LOH choices
There are two ways to average Cv/Cb: First is to calculate the ratio in each experiment and then average by experiments. Second is to average Cv and Cb by experiment and then calculate the ratio. The second method seems to generate large variance and is therefore more prone to experimental errors.
Because some strains are extremely sensitive to H2O2 so their Cv is very small, which leads to large fluctuations. So, Cv/Cb is more stable, and this is my best choice from the practical perspective.
Because some strains are extremely sensitive to H2O2 so their Cv is very small, which leads to large fluctuations. So, Cv/Cb is more stable, and this is my best choice from the practical perspective.
Friday, November 22, 2013
Renew network connections on Windows
cmd
ipconfig /renew
ipconfig /renew
Thursday, November 21, 2013
Friday, November 15, 2013
Multicollinearity, correlated predictors in regression
Multicollinearity does not influence the prediction of response (y), but it affect the interpretation of individual predictors.
http://en.wikipedia.org/wiki/Multicollinearity
https://onlinecourses.science.psu.edu/stat501/node/82
*** How to generated correlated random numbers with specifed R-squared
R^2 = 1 - SSres / SStot
SSres = sum of (y_obs - fitted)^2
SStot = sum of (y_obs - y_mean)^2
For y = rho * x1 + sqrt(1-rho^2)*x2
rho^2 = 1- (y - x1*rho)^2 / (x2^2)
For standardized random numbers
x1 = rnorm(100)
x2 = rnorm(100)
rho = 0.5
y = rho * x1 + sqrt(1-rho^2)*x2
http://www.sitmo.com/article/generating-correlated-random-numbers/
> set.seed(2014)
> N=500
> x = rnorm(N)
> error = rnorm(N)
> rho = sqrt(0.5)
> y= rho*x + sqrt(1-rho^2)*error #rho is the slope
> summary(lm(y ~ x ))
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-1.85255 -0.47818 0.04374 0.46947 2.17727
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.00915 0.03101 -0.295 0.768
x 0.69389 0.03165 21.921 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6915 on 498 degrees of freedom
Multiple R-squared: 0.4911, Adjusted R-squared: 0.49
F-statistic: 480.5 on 1 and 498 DF, p-value: < 2.2e-16
Generate non-standardized random numbers
> set.seed(2014)
> x=rnorm(1000)*4+2
> error = rnorm(1000)
> rho=sqrt(0.5)
> y = rho*(x-2)/4 + sqrt(1-rho^2)*error
> summary(lm(y~x))
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-2.1879 -0.4414 -0.0138 0.4289 2.7802
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.37723 0.02428 -15.53 <2e-16 ***
x 0.18475 0.00546 33.83 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6751 on 998 degrees of freedom
Multiple R-squared: 0.5342, Adjusted R-squared: 0.5338
F-statistic: 1145 on 1 and 998 DF, p-value: < 2.2e-16
>
> y2 = y*4+2*rho
> summary(lm(y2~x))
Call:
lm(formula = y2 ~ x)
Residuals:
Min 1Q Median 3Q Max
-8.7515 -1.7656 -0.0552 1.7155 11.1207
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.09471 0.09713 -0.975 0.33
x 0.73899 0.02184 33.834 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.701 on 998 degrees of freedom
Multiple R-squared: 0.5342, Adjusted R-squared: 0.5338
F-statistic: 1145 on 1 and 998 DF, p-value: < 2.2e-16
Labels:
***,
R,
random numbers,
Rsquared,
star,
statistics
AIC ( preferred model is the one with the lowest AIC value)
Akaike information criterion
AIC = 2k - 2ln(L)
So, the preferred model is the one with the lowest AIC value.
See example at
http://www.r-bloggers.com/linear-regression-with-correlated-data/
From wikipedia,
Subscribe to:
Posts (Atom)


