Archive for April, 2010

Your Gut Bacteria Are What You Eat

Thursday, April 8th, 2010

A new study found that Japanese people, but not Americans, have gut bacteria that help them digest seaweed. The Japanese eat a lot more seaweed than Americans, of course. Presumably they acquired the gut bacteria from eating seaweed that wasn’t hyper-sterile. It’s more evidence that we are not designed to eat hyper-sterile food.

Thanks to Aaron Blaisdell and Deborah Estrin.

Arithmetic Test R Code (part 3)

Wednesday, April 7th, 2010

> newmath2.set.types
function ()
{# set variables in newmath2 to proper types
#
newmath2$year< <-as.integer(newmath2$year)
newmath2$month< <-as.integer(newmath2$month)
newmath2$day< <-as.integer(newmath2$day)
newmath2$hour< <-as.integer(newmath2$hour)
newmath2$minute< <-as.integer(newmath2$minute)
newmath2$second< <-as.integer(newmath2$second)
newmath2$condition< <-as.character(newmath2$condition)
newmath2$trial< <-as.integer(newmath2$trial)
newmath2$wait.msec< <-as.integer(as.character(newmath2$wait.msec))
newmath2$problem< <-as.character(newmath2$problem)
newmath2$answer.msec< <-as.integer(newmath2$answer.msec)
newmath2$actual.answer< <-as.integer(newmath2$actual.answer)
newmath2$correct< <-as.logical(newmath2$correct)
newmath2$include< <-as.logical(newmath2$include)
newmath2$note< <-as.character(newmath2$note)
}
> save.ws
function ()
{
invisible()
save.image(“C:/Documents and Settings/Seth/My Documents/omega-3/tracking.RData”)
cat(“tracking workspace saved”,as.character(Sys.time()),”\n”)
}

Arithmetic Test R Code (part 2)

Wednesday, April 7th, 2010

new.condition
function (conditions.so.far = newmath$condition)
{# get new condition name
#
#             conditions.so.far        vector of conditions so far
#
cat(“current time”,as.character(Sys.time()),”\n”)
t=as.character(tail(conditions.so.far,1)) #malfunctions without as.character
cat(“most recent condition”,t,”\nthis condition”)
condition=scan(nlines=1,what=”character”,quiet=TRUE, sep=”!”)
condition
}

> newmath2.problems
problem answer
[1,] “2*7″   “4″
[2,] “1*7″   “7″
[3,] “4+4″   “8″
[4,] “8+5″   “3″
[5,] “11-2″  “9″
[6,] “4+6″   “0″
[7,] “0*8″   “0″
[8,] “0+4″   “4″
[9,] “9*3″   “7″
[10,] “16-9″  “7″
[11,] “6*8″   “8″
[12,] “7*6″   “2″
[13,] “0+0″   “0″
[14,] “10-9″  “1″
[15,] “1*1″   “1″
[16,] “8*8″   “4″
[17,] “14-7″  “7″
[18,] “5+5″   “0″
[19,] “7-3″   “4″
[20,] “3+5″   “8″
[21,] “0+7″   “7″
[22,] “4-4″   “0″
[23,] “1+8″   “9″
[24,] “4*1″   “4″
[25,] “3*1″   “3″
[26,] “3-2″   “1″
[27,] “7*9″   “3″
[28,] “0+8″   “8″
[29,] “1*2″   “2″
[30,] “9*1″   “9″
[31,] “0*0″   “0″
[32,] “7+1″   “8″
[33,] “2-2″   “0″
[34,] “4+5″   “9″
[35,] “11-4″  “7″
[36,] “4+3″   “7″
[37,] “1*0″   “0″
[38,] “1*4″   “4″
[39,] “12-8″  “4″
[40,] “7*1″   “7″
[41,] “2-1″   “1″
[42,] “4*6″   “4″
[43,] “9-6″   “3″
[44,] “12-3″  “9″
[45,] “4+9″   “3″
[46,] “9+4″   “3″
[47,] “9*7″   “3″
[48,] “15-7″  “8″
[49,] “3*3″   “9″
[50,] “8-0″   “8″
[51,] “8*9″   “2″
[52,] “11-8″  “3″
[53,] “2*2″   “4″
[54,] “10-2″  “8″
[55,] “9+8″   “7″
[56,] “8-4″   “4″
[57,] “2+1″   “3″
[58,] “8+3″   “1″
[59,] “7-6″   “1″
[60,] “3-3″   “0″
[61,] “9*9″   “1″
[62,] “8+1″   “9″
[63,] “6*4″   “4″
[64,] “9+9″   “8″
[65,] “4*2″   “8″
[66,] “6-5″   “1″
[67,] “7+5″   “2″
[68,] “9*0″   “0″
[69,] “3*7″   “1″
[70,] “8*1″   “8″
[71,] “2+8″   “0″
[72,] “0+2″   “2″
[73,] “8+0″   “8″
[74,] “5-4″   “1″
[75,] “6-3″   “3″
[76,] “2*0″   “0″
[77,] “15-6″  “9″
[78,] “1*9″   “9″
[79,] “7-0″   “7″
[80,] “12-9″  “3″
[81,] “9+3″   “2″
[82,] “4+7″   “1″
[83,] “1+7″   “8″
[84,] “6-4″   “2″
[85,] “6+7″   “3″
[86,] “0+3″   “3″
[87,] “6+3″   “9″
[88,] “13-5″  “8″
[89,] “6+1″   “7″
[90,] “16-8″  “8″
[91,] “6+5″   “1″
[92,] “8*6″   “8″
[93,] “4*0″   “0″
[94,] “5+4″   “9″
[95,] “6+4″   “0″
[96,] “3*9″   “7″
[97,] “4+8″   “2″
[98,] “5-3″   “2″
[99,] “7+0″   “7″
[100,] “15-8″  “7″
[101,] “7*3″   “1″
[102,] “3+7″   “0″
[103,] “6+2″   “8″
[104,] “4-3″   “1″
[105,] “11-3″  “8″
[106,] “9+2″   “1″
[107,] “5-5″   “0″
[108,] “7+6″   “3″
[109,] “9+1″   “0″
[110,] “1*3″   “3″
[111,] “1+2″   “3″
[112,] “2+0″   “2″
[113,] “6-2″   “4″
[114,] “13-9″  “4″
[115,] “2*1″   “2″
[116,] “9+0″   “9″
[117,] “9-1″   “8″
[118,] “3-0″   “3″
[119,] “12-4″  “8″
[120,] “2+9″   “1″
[121,] “10-6″  “4″
[122,] “1+0″   “1″
[123,] “4-0″   “4″
[124,] “0*2″   “0″
[125,] “9*2″   “8″
[126,] “14-5″  “9″
[127,] “5-1″   “4″
[128,] “9-5″   “4″
[129,] “3+0″   “3″
[130,] “17-8″  “9″
[131,] “2+7″   “9″
[132,] “5+6″   “1″
[133,] “8-1″   “7″
[134,] “7-5″   “2″
[135,] “3+6″   “9″
[136,] “6*0″   “0″
[137,] “0*4″   “0″
[138,] “1*8″   “8″
[139,] “7-4″   “3″
[140,] “7+2″   “9″
[141,] “6-6″   “0″
[142,] “9-9″   “0″
[143,] “10-7″  “3″
[144,] “3+1″   “4″
[145,] “2+5″   “7″
[146,] “5+9″   “4″
[147,] “5+3″   “8″
[148,] “8+6″   “4″
[149,] “0*5″   “0″
[150,] “0+9″   “9″
[151,] “1-1″   “0″
[152,] “3-1″   “2″
[153,] “7*2″   “4″
[154,] “7+4″   “1″
[155,] “7+3″   “0″
[156,] “1+1″   “2″
[157,] “6+6″   “2″
[158,] “9-7″   “2″
[159,] “9-8″   “1″
[160,] “9*8″   “2″
[161,] “2*4″   “8″
[162,] “8-5″   “3″
[163,] “14-6″  “8″
[164,] “9-2″   “7″
[165,] “7*4″   “8″
[166,] “6+8″   “4″
[167,] “16-7″  “9″
[168,] “4*3″   “2″
[169,] “8+4″   “2″
[170,] “8+2″   “0″
[171,] “0*9″   “0″
[172,] “6*2″   “2″
[173,] “10-1″  “9″
[174,] “4-2″   “2″
[175,] “3*8″   “4″
[176,] “4-1″   “3″
[177,] “7-7″   “0″
[178,] “9-0″   “9″
[179,] “2*6″   “2″
[180,] “12-5″  “7″
[181,] “0-0″   “0″
[182,] “0*7″   “0″
[183,] “2+6″   “8″
[184,] “0*6″   “0″
[185,] “11-7″  “4″
[186,] “0*3″   “0″
[187,] “18-9″  “9″
[188,] “5+2″   “7″
[189,] “4+0″   “4″
[190,] “8*4″   “2″
[191,] “8*3″   “4″
[192,] “8-8″   “0″
[193,] “0*1″   “0″
[194,] “7+7″   “4″
[195,] “2+2″   “4″
[196,] “13-6″  “7″
[197,] “8*0″   “0″
[198,] “5*0″   “0″
[199,] “8+9″   “7″
[200,] “3+8″   “1″
[201,] “1+3″   “4″
[202,] “2*9″   “8″
[203,] “5-2″   “3″
[204,] “10-3″  “7″
[205,] “4*7″   “8″
[206,] “8-6″   “2″
[207,] “11-9″  “2″
[208,] “1-0″   “1″
[209,] “9+5″   “4″
[210,] “6*7″   “2″
[211,] “3*0″   “0″
[212,] “10-8″  “2″
[213,] “3*4″   “2″
[214,] “1+6″   “7″
[215,] “13-4″  “9″
[216,] “3+9″   “2″
[217,] “5+8″   “3″
[218,] “17-9″  “8″
[219,] “0+1″   “1″
[220,] “8-7″   “1″
[221,] “7*0″   “0″
[222,] “5+7″   “2″
[223,] “2-0″   “2″
[224,] “4*8″   “2″
[225,] “3+4″   “7″
[226,] “1+9″   “0″

> newmath2.trial
function (trial = 1, total.trials = 5, problem=newmath2.problems[1,],condition= “testing”, wait.range=c(1500,2500), num.possible=9, note = “”)
{#give one trial. returns list with components wait, answer.msec, etc.
#(“okay” or “aborted”) and results.
#
#              trial             trial number
#              total.trials      trials per session
#              problem           problem, answer (characters)
#              condition
#              wait.range        range of wait times (msec)
#              num.possible      number of possible wait times
#              note
#
tn=paste(“trial”,trial,”of”,total.trials)
msg=press.space.to.start(below=tn, col = “brown”)
if(msg==”end session”) return(“end session”)
wait.msec=newmath2.foreperiod(wait.range=wait.range, num.possible = num.possible)
t=newmath2.problem(problem=problem)
newmath2.feedback(problem=problem[1],answer.msec=t$answer.msec,correct=t$correct,status=t$status)
list(wait.msec=wait.msec, answer.msec=t$answer.msec,actual.answer=t$actual.answer, correct=t$correct,include=t$include,status=t$status)
}

Arithmetic Test R Code (part 1)

Tuesday, April 6th, 2010

[Below is some of the R code that runs the arithmetic test that I use to measure my brain function. This function (newmath2.add) is the top-level function -- the function I actually call when I run the test. Later posts will give the subroutine code. The variable newmath2 is the database -- the variable (a data frame) that holds the data.]

function (trials = 32, note=”", wait.range=c(1000,2000), num.possible = 9)
{#Like newmath but with separated trials.
#
#Collect data with arithmetic-like task. Simple arithmetic problems with
#the answer being a single digit. 1, 2, 3, 4, 7, 8, 9, 0 equally likely.
#If the answer is two digits (e.g., 12) it is truncated to the last digit
#(e.g., 2). The trials during each session are sampled without replacement
#from all possible problems.
#
#Trials where the response is incorrect are repeated with a new problem.
#Trials can be aborted; this is noted.
#
#               trials            trials in a session
#               note              comment for each trial
#               wait.range        range of wait times (msec)
#               num.possible      number of possible wait times
#
# 2009.07.11 Fixation symbol changed from + to o. Repetition of
# answer from one question to the next no longer allowed.
# 2009.07.15 Feedback now based only on answers to the same question
# More sophisticated computation of percentile.
# 2009.08.07 Can end session from Press Space screen
# 2009.10.23 fixed abort session and abort trial
#
invisible()
condition=new.condition(newmath2$condition)
start.time=Sys.time()
n=nrow(newmath2.problems)
problems=newmath2.problems[sample(n),]
okay=c(TRUE,!problems[1:(n-1),2]==problems[2:n,2])
problems=problems[okay,]
tr=1
pr=1
while(tr< =trials){
t=newmath2.trial(trial=tr, total.trials = trials, wait.range=wait.range, num.possible = num.possible, problem = problems[pr,], condition=condition, note=note)
if(t[1]==”end session”) break
if(t$status!=”okay”) {
if(t$status==”abort trial”) this.trial.note=”trial aborted”
if(t$status==”abort session”) this.trial.note=”session aborted”
t$include=FALSE
}
else this.trial.note=note
new.line1=c(current(),condition,tr,t$wait.msec, problems[pr,1])
new.line2=c(t$answer.msec,t$actual.answer,t$correct,t$include,this.trial.note)
newmath2< <-rbind(newmath2,c(new.line1,new.line2))
newmath2.set.types()
pr=pr+1
if(t$status==”abort session”) break
if(t$status==”abort trial”) next
if(!t$correct) next
tr=tr+1
}
msg=paste(“total time”,round(difftime(Sys.time(),start.time, unit=”mins”),1),”minutes\n”)
paint(above = “all done”, below=msg, duration = 3)
save.ws()
newmath2.plot()
}

“My Porphyria Went Away”

Monday, April 5th, 2010

I asked Aaron Blaisdell what was most surprising about his experience with “ancestral health” — adopting a evolutionarily reasonable diet. “That my porphyria went away,” he said. Aaron’s porphyria is/was a form of sun sensitivity. “My mother has it. Her father had it,” he said. It was obviously genetic. Scientists had located the genes involved. Aaron assumed that someday, not soon, it might be possible to fix the genes involved. Until then, he didn’t think anything would change. It was a rare and not particularly damaging disease — it wouldn’t attract a lot of research.

How reasonable the gene-fix idea sounds, in spite of being wrong. I’ve heard dozens of scientists, including Bruce Ames and James Watson, say that we are entering a new age where we will figure out the causes of diseases (their genetic causes) and fix them. A new age of rational medicine. To fix a car or dishwasher, you figure out the part at fault and repair or replace it. The metaphor is so convincing that nobody points out another possible metaphor: Your washing machine isn’t working because you haven’t plugged it in. You need to read the owner’s manual. Most health-care researchers, especially at medical schools, are studying the parts diagram of the washing machine, trying to figure out what part is at fault, when the problem is elsewhere: Not plugged in. Much easier to fix.