Learning from Biased Agents

Table of Contents


1 Data Analysis

1.1 Prep the Data

require(sqldf)
options(sqldf.driver = "SQLite")
require('RMySQL')

query <- function(con, query){
    db <- dbGetQuery(con, query)[-1]
    data.frame(lapply(db, function(x){
        if(is.character(x)){
            tryCatch({
                as.POSIXlt(x)
            }, error = function(err)
                {
                    if (nchar(x[1])<15){factor(x)}
                    else{x}
                })
        }
        else{x}
    }))
}

##ssh -L 3307:localhost:3306 djthorne@104.131.138.238
con = dbConnect(MySQL(), host="127.0.0.1", user="djthorne",
      password="************", db="*******", port=3307)

dj_trials <- query(con, "select * from lfba_trials")
dj_subj <- query(con, "select * from lfba_subj")
dj_check <- query(con, "select * from lfba_check")
dj_system <- query(con, "select * from lfba_system")
dj_condition <- query(con, "select * from lfba_condition")

## add condition to trials
trials <- sqldf("select dj_trials.*, dj_condition.*
                    from dj_trials
                    inner join dj_condition
                    on dj_trials.uwid=dj_condition.uwid
                    ")

## add condition and trials and check
trials_all <- sqldf("select dj_trials.*, dj_condition.*, dj_check.*
                          from dj_trials
                          inner join dj_condition
                          on dj_trials.uwid=dj_condition.uwid
                          inner join dj_check
                          on dj_trials.uwid=dj_check.uwid
                          ")

1.2 Analyses

1.2.1 Pilot Experiment

Condition N

[1] 64
[1] 53

e1 e2 e3
12 15 37
1.2.1.1 Baseline

a.png

b.png

1.2.1.2 Main Effect

c.png

compared with mean response

d.png

compared to baseline

62.png

1.2.1.3 By Subject

e.png

1.2.1.4 Final

f.png

g.png

1.2.2 Leaner Experiment

1.2.2.1 “All” condition

Condition N

[1] 30
1.2.2.1.1 Baseline

i.png

j.png

1.2.2.1.2 Main Effect

k.png

Condition N

[1] 30
1.2.2.1.3 Main Effect

l.png

Within subjects difference from impartial

m.png

n.png

1.2.2.2 “No but” condition

Condition N

[1] 70
1.2.2.2.1 By Subj

o.png

1.2.2.2.2 Main Effect

p.png

Within subjects difference from impartial

q.png

r.png

1.2.2.2.3 1st trial

q.png

1.2.3 Final

r.png

Between Subjects

t.png