-
Notifications
You must be signed in to change notification settings - Fork 1
/
SM01_Analysis.Rmd
89 lines (74 loc) · 2.01 KB
/
SM01_Analysis.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
title: "R Notebook"
output: html_notebook
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Cmd+Shift+Enter*.
```{r}
plot(cars)
```
```{r}
data <- read.csv(file = "SM01_Retest_Aesthetic_Task.csv")
print(data)
```
```{r}
#Splitting the dataframe by subject
sbj <- split (data, data$subj)
sbj[[1]]
```
```{r}
```
```{r}
library("retimes")
```
```{r}
#running loop for the aesthetic task
d = NULL
for (i in 1:100){
dist <- timefit(sbj[[i]]$durs, iter = 10)
mu[i] <- dist@par[1]
sig[i] <- dist@par[2]
tau[i] <- dist@par[3]
log_like[i] <- dist@logLik
aic[i] <- dist@AIC
bic[i] <- dist@BIC
}
d <- rbind(d, data.frame(mu, sig, tau, log_like, aic, bic))
d$subject <- 1:nrow(d)
print(d)
```
```{r}
for (x in 1:100){
durs_mean [x] <- mean(sbj[[x]]$durs)
}
print(durs_mean)
```
```{r}
write.csv(d, file = "Aesthetic_Retest_Gauss.csv", row.names=FALSE)
```
```{r}
mem_data <- read.csv(file = "SM01_Retest_Memorize_Task.csv")
print(mem_data)
```
```{r}
mem_sbj <- split (mem_data, mem_data$subj)
mem_sbj[[1]]
```
```{r}
df = NULL
for (i in 1:100){
dist <- timefit(mem_sbj[[i]]$durs)@par
mu[i] <- dist[1]
sig[i] <- dist[2]
tau[i] <- dist[3]
}
df <- rbind(df, data.frame(mu, sig, tau))
df$subject <- 1:nrow(df)
print(df)
```
```{r}
write.csv(df, file = "Memorize_Retest_Gauss.csv", row.names=FALSE)
```
Add a new chunk by clicking the *Insert Chunk* button on the toolbar or by pressing *Cmd+Option+I*.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the *Preview* button or press *Cmd+Shift+K* to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike *Knit*, *Preview* does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.