This line reads in the data from an individual observer. To get this to run on computers with a different directory tree, we’ll need to do some editing.

pilot.dat <- read.csv('~/Dropbox/wrk/mindfulness/pilot study/data/99_PIlot Study_2015_Sep_20_1908.csv')

This does regression from orientation onto response key.

pilot.lm <- lm(resp.keys ~ orientation, pilot.dat)

To match Steven’s Power Law, I can do “log-log” linear regression. Steven’s Power law is expressed as \(\psi = k\phi^a\). If I take the log of both sides, I get \(\log\psi = a \log\phi + \log k\). The slope of the line is \(a\), and the intercept is \(\log k\). I’ll plug those in below to see what we have in the original units.

pilot.pl <- lm(log(resp.keys) ~ log(orientation), pilot.dat)
summary(pilot.pl)
## 
## Call:
## lm(formula = log(resp.keys) ~ log(orientation), data = pilot.dat)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.06100 -0.09487 -0.02225  0.08384  0.54844 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -0.13512    0.14735  -0.917    0.362    
## log(orientation)  0.51946    0.03979  13.056   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2072 on 73 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.7002, Adjusted R-squared:  0.6961 
## F-statistic: 170.5 on 1 and 73 DF,  p-value: < 2.2e-16

This is the “log-log” plot with the linear regression line.

This is back to the original units with the best fitting line and the best fitting power law. The power law in this figure is the same as the blue line in the previous figure — just with the different units.