My Math Forum  

Go Back   My Math Forum > High School Math Forum > Algebra

Algebra Pre-Algebra and Basic Algebra Math Forum


Reply
 
LinkBack Thread Tools Display Modes
April 21st, 2008, 05:45 AM   #1
Newbie
 
Joined: Apr 2008

Posts: 3
Thanks: 0

Error bars on log-transformed plots?

Hello - I am a genetics researcher. I have a series of data points with errors (standard errors), that I wish to plot as a column plot with error bars:

GENE, AVG FOLD CHANGE, SE

Gene1, 2193.10, 1200.74
Gene2, 96.28, 9.08
Gene3, 39.02, 22.51
Gene4, 5.88, 0.82
Gene5, -0.68, 0.33
Gene6, 1.14, 0.02
Gene7, -1.46, 0.16
Gene8, -1.56, 0.50
Gene9, -1.58, 0.10
Gene10, -1.88, 0.45
Gene11, -2.04, 0.45
Gene12, -6828.82, 975.41

Positive values are up-regulated genes; negative values are down-regulated genes (re: gene expression levels).

I wish to plot this as a column plot on a log scale (y-axis) with negative values below the zero baseline, positive values above, and with the errors indicated.

Something like:

1000
100
10 *
1 *
0-------------------
-1 *
-10 *
-100
-1000

but with bars instead of the asterisks - you get the idea. I can do this easily enough using MS Excel, by taking the log of the absolute value, multiplying the result by +1 or -1 (to restore the original "directionality" - i.e. up- or down-regulated).

A couple of questions:

(Q1) Is it "better" to use log (base 10) or ln (natural) log transformations?

(Q2) How would I present the error bars - would I log (or ln) -transform the standard errors, for example, and plot these [or the absolute values of these, since the log of numbers <1 are negative; e.g. log(0.5) = -0.301)]?

I tried finding the answer to these questions in Google, but I wasn't very successful. ...

I would very much appreciate any comments regarding the log-transformation of data and plots of log-transformed data, particularly regarding error bars!

Thank you!

Sincerely,

Greg :-)
gstuart is offline  
 
April 22nd, 2008, 02:06 PM   #2
Newbie
 
Joined: Apr 2008

Posts: 3
Thanks: 0

Hello - I think I have this right ...

Referring to the sample data (below; this would be easier, if I could attach my Excel spreadsheet), I first log-transformed my data,

x = log( |x| + 1)

using the absolute values (to avoid taking the log of negative numbers) and adding 1 (to avoid taking the log of zero).

Next, I multiplied these log-transformed values by +1 (to indicate up-regulated genes) or -1 (to indicate down-regulated genes).

Last, I calculated the mean and standard error of these log-transformed data, and plotted the results.

I think that this is correct - please comment, if I am mistaken.

Thank you! Greg :-)

=========== Test Data: ============

SE (= SD /(n^0.5) - i.e. SD / sqrt(number of data points)

log ( | fold-change +1 | ) - i.e. log of (absolute value +1)

"Correction:" Multiplier +1 (up-regulated) or -1 (down-regulated)

-----------------------------------

Gene // Fold-change // Mean // SD // SE (= SD /(n^0.5) // log ( | fold-change +1 | ) // Up-reg: 1; Down-reg: -1 // "Corrected" log(fold-change) // Mean [corrected log(fold-change)] // SE [corrected log(fold-change)]

Gene1 -36865.92 < Outlier - ignore
Gene1 -8023.41 3.904 -1 -3.904
Gene1 -5634.22 -6828.815 1689.412 1194.595 3.751 -1 -3.751 -3.828 0.077

Gene2 1.04 0.310 1 0.310
Gene2 1.08 0.318 1 0.318
Gene2 -2.57 -0.150 2.096 1.210055095 0.196 -1 -0.196 0.144 0.170

Gene3 1.24 0.350 1 0.350
Gene3 -2.75 0.243 -1 -0.243
Gene3 -1.64 -1.050 2.059 1.188991169 -0.194 -1 0.194 0.100 0.178

Gene4 -1.09 -1.046 -1 1.046
Gene4 -1.16 -0.796 -1 0.796
Gene4 -1.16 -1.137 0.040 0.023333333 -0.796 -1 0.796 0.879 0.083

Gene5 6.06 0.849 1 0.849
Gene5 7.21 0.914 1 0.914
Gene5 4.38 5.883 1.423 0.821712304 0.731 1 0.731 0.831 0.054

Gene6 -1.64 -0.194 -1 0.194
Gene6 -1.60 -0.222 -1 0.222
Gene6 1.13 -0.703 1.588 0.916739391 0.328 1 0.328 0.248 0.041

Gene7 1438.15 3.158 1 3.158
Gene7 4544.80 3.658 1 3.658
Gene7 596.34 2193.097 2079.674 1200.700135 2.776 1 2.776 3.197 0.255

Gene8 83.29 1.926 1 1.926
Gene8 113.77 2.060 1 2.060
Gene8 91.77 96.277 15.732 9.082770013 1.967 1 1.967 1.984 0.040

Gene9 83.29 1.926 1 1.926
Gene9 9.85 1.035 1 1.035
Gene9 23.92 39.020 38.979 22.50456176 1.397 1 1.397 1.453 0.259

Gene10 -1.17 -0.770 -1 0.770
Gene10 0.80 0.255 1 0.255
Gene10 -0.06 -0.143 0.988 0.570214385 -0.027 -1 0.027 0.351 0.220
0.000
Gene11 -1.75 -0.125 -1 0.125
Gene11 -1.57 -0.244 -1 0.244
Gene11 -1.41 -1.577 0.170 0.098206132 -0.387 -1 0.387 0.252 0.076

Gene12 1.16 0.334 1 0.334
Gene12 -2.36 0.134 -1 -0.134
Gene12 -2.60 -1.267 2.105 1.215309746 0.204 -1 -0.204 -0.001 0.169

Summary - Log-transformed data:

Gene Mean SE
Gene7 3.197 0.255
Gene8 1.984 0.040
Gene9 1.453 0.259
Gene4 0.879 0.083
Gene5 0.831 0.054
Gene10 0.351 0.220
Gene11 0.252 0.076
Gene6 0.248 0.041
Gene2 0.144 0.170
Gene3 0.100 0.178
Gene12 -0.001 0.169
Gene1 -3.828 0.077
gstuart is offline  
April 22nd, 2008, 04:45 PM   #3
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Ah, fold changes? I work in a genotyping lab part time (in addition to my full-time job, naturally) so I have familiarity, though not expertise, in the subject.

The log transform is standard; Knudsen uses the same, as I recall.

(Q1) Is it "better" to use log (base 10) or ln (natural) log transformations?

They will be visually identical. Any choice of logarithm will give the same shape, changing only the scale. For ease of use I would recommend common (base 10) or binary (base 2) depending on the size of the effect -- base 10 with your data, probably.

(Q2) How would I present the error bars - would I log (or ln) -transform the standard errors, for example, and plot these [or the absolute values of these, since the log of numbers <1 are negative; e.g. log(0.5) = -0.301)]?

If the value is 1000 and the standard error is 100, I would plot the error bars at log (|1000 + 100| + 1) and log (|1000 - 100| + 1). This puts them on the same scale as the data. Don't use the log of the error directly!
CRGreathouse is offline  
April 24th, 2008, 12:33 PM   #4
Newbie
 
Joined: Apr 2008

Posts: 3
Thanks: 0

Hello - When I didn't get an initial response here (after several days), I cross-posted this thread, to the URL / forum, below.

I continued pursuing this topic (there), as I was able to upload a MS Excel file, that contained my test data, plus annotations.

Please refer here for the resolution of this problem:

http://www.talkstats.com/showthread.php ... #post10965

Thanks, once again, for your replies - appreciated.


Sincerely, Greg :-)
gstuart is offline  
April 24th, 2008, 06:12 PM   #5
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Looks like the answers you got there were the same as what I posted. Well, I'm glad you got your answers!
CRGreathouse is offline  
Reply

  My Math Forum > High School Math Forum > Algebra

Tags
bars, error, logtransformed, plots



Search tags for this page
Click on a term to search for related topics.
Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
gama vs function plots ungeheuer Calculus 3 August 22nd, 2013 02:20 PM
possible error/relative error jkh1919 Calculus 5 August 4th, 2012 07:30 PM
Relative error Percenttage error esther Calculus 1 October 25th, 2011 04:57 AM
candy bars e81 Algebra 7 May 21st, 2011 10:09 AM
What class of problem is it or could be transformed to? pagfloyd Applied Math 0 September 27th, 2009 10:33 PM





Copyright © 2018 My Math Forum. All rights reserved.