LearningToTalk / L2TDatabase

Helper functions for working with our lab's MySQL database
GNU General Public License v2.0
0 stars 0 forks source link

queries for aggregated sails scores #38

Closed tjmahr closed 8 years ago

tjmahr commented 8 years ago

We now have 25,500 trials from 335 SAILS administrations in database. Need to provide queries that aggregate over these responses.

tjmahr commented 8 years ago

done. a demo of the tp2 query

library("dplyr")
library("L2TDatabase")
library("ggplot2")

# Connect to db
cnf_file <- file.path(getwd(), "inst/l2t_db.cnf")
l2t <- l2t_connect(cnf_file)

# download tp2 query
tp2 <- collect(tbl(l2t, "q_Scores_TimePoint2"))

ggplot(tp2) +
  aes(x = SAILS_ProportionTestCorrect) +
  geom_histogram(binwidth = .05)

image

ggplot(tp2) +
  aes(x = EVT_GSV, y = SAILS_ProportionTestCorrect) +
  geom_point() +
  stat_smooth(method = "lm")

image

summary(lm(SAILS_ProportionTestCorrect ~ EVT_GSV, tp2))
#> 
#> Call:
#> lm(formula = SAILS_ProportionTestCorrect ~ EVT_GSV, data = tp2)
#> 
#> Residuals:
#>      Min       1Q   Median       3Q      Max 
#> -0.22621 -0.07361 -0.01537  0.08100  0.23176 
#> 
#> Coefficients:
#>               Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) -0.2503208  0.1123462  -2.228   0.0275 *  
#> EVT_GSV      0.0066083  0.0008129   8.129 2.21e-13 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.1019 on 138 degrees of freedom
#>   (42 observations deleted due to missingness)
#> Multiple R-squared:  0.3238, Adjusted R-squared:  0.3189 
#> F-statistic: 66.09 on 1 and 138 DF,  p-value: 2.208e-13
janroslynedwards commented 8 years ago

This is awesome! Thanks for the demo!!!

BenjaminMunson commented 8 years ago

Cool. What's the ID for the low sails kid? Is it the same one who was gaming us on min pair at tp1?