This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
occlusion2.data$qqplot.comparison.resid <- ddply(.data = occlusion2.data$qqplot.comparison, .variables = .(condition, transformed), function(dat){ | |
q <- qqnorm(dat$threshold, plot = FALSE) | |
dat$xq <- q$x | |
dat | |
} | |
) | |
occlusion2.qqplot <- ggplot(data = occlusion2.data$qqplot.comparison.resid, aes(x = xq, y = threshold)) + | |
geom_smooth(method = "lm", se = FALSE, size = 1) + | |
geom_point() + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(plyr) | |
require(dplyr) | |
data.outliersRemoved<-ddply(data, .(withinIV1, withinIV2), function(d){ | |
limits.outliers = median(d$DV) + 2.5*c(-1, 1)*mad(d$DV)) | |
d$DV[which(((d$DV - limits.outliers[1])*(limits.outliers[2] - d$DV)) <= 0)]<-NA | |
return(d) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ggplot(NULL, aes(x = x, y = NULL))+ | |
geom_point(data = data, | |
aes(y = y, fill = z, color = z), | |
position = position_jitterdodge(jitter.width = .2, jitter.height = .2, dodge.width = .9), | |
alpha = .15, size = 3)+ | |
geom_crossbar(data = data.frame(summary(lsmeans(mixed.model$full.model, ~ z|x)), | |
aes(y = lsmean, ymax = upper.CL, ymin = lower.CL, color = view), | |
size = 1, position = "dodge", fatten = 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssw2014.data$behavioural$resid.log.crossedTNO<-residuals(lm(log.crossedTNO~log.uncrossedTNO, data = ssw2014.data$behavioural)) | |
ssw2014.data$behavioural$resid.log.uncrossedTNO<-residuals(lm(log.uncrossedTNO~log.crossedTNO, data = ssw2014.data$behavioural)) | |
ssw2014.data$behavioural$c.resid.log.crossedTNO<-scale(ssw2014.data$behavioural$resid.log.crossedTNO, center = T, scale = F) | |
ssw2014.data$behavioural$c.resid.log.uncrossedTNO<-scale(ssw2014.data$behavioural$resid.log.uncrossedTNO, center = T, scale = F) | |
ssw2014.data$behavioural$principal.component.TNO<-prcomp(ssw2014.data$behavioural[,c("log.crossedTNO", "log.uncrossedTNO")], center = T, scale. = T)$x[,"PC1"] | |
ssw2014.data$behavioural$c.principal.component.TNO<-scale(ssw2014.data$behavioural$principal.component.TNO, center = T, scale = F) | |
ssw2014.mixed.all.residUncrossed<-mixed(formula = z.score ~ view*activity*c.log.crossedTNO*c.age + view*activity*c.resid.log.uncrossedTNO*c.age + (1+activity+view|ID), data = ssw2014.data$behavioural) | |
ssw2014.mixed.all.resi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> sessionInfo() | |
R version 3.2.2 (2015-08-14) | |
Platform: x86_64-apple-darwin13.4.0 (64-bit) | |
Running under: OS X 10.10.5 (Yosemite) | |
locale: | |
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 | |
attached base packages: | |
[1] stats graphics grDevices utils datasets methods base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lm.beta.lmer <- function(mod) { | |
b <- fixef(mod)[-1] | |
sd.x <- apply(getME(mod,"X")[,-1],2,sd) | |
sd.y <- sd(getME(mod,"y")) | |
b*sd.x/sd.y | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
R version 3.1.0 (2014-04-10) | |
Platform: x86_64-apple-darwin13.1.0 (64-bit) | |
locale: | |
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 | |
attached base packages: | |
[1] splines grid stats graphics grDevices utils datasets methods base | |
other attached packages: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runNum = input('run number: '); | |
% Load rocket image | |
endRocket.load = imread('rocket2.png'); | |
endRocket.texture = Screen('MakeTexture', windowPtr, endRocket.load); | |
% Get the size of the image | |
[s1, s2, s3] = size(endRocket.load); | |
% Get the aspect ratio of the image. We need this to maintain the aspect | |
% ratio of the image when we draw it different sizes. Otherwise, if we | |
% don't match the aspect ratio the image will appear warped / stretched |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
close all | |
clear all; | |
screenParams.Res = [1024 768]; | |
visAngPxl = 0.0018; % visual angle subtended by a single pixel | |
% Find center of screen: | |
xcen = screenParams.Res(1)/2; | |
ycen = screenParams.Res(2)/2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% gaborDotsMinimal.m | |
% An example of how to draw dots using PTB3's `CreateProceduralGabor` | |
sca; | |
try | |
% PTB-3 correctly installed and functional? Abort otherwise. | |
AssertOpenGL; | |
% Select screen with maximum id for output window: | |
screenid = max(Screen('Screens')); |
NewerOlder