-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrms_RRi.R
45 lines (30 loc) · 1.4 KB
/
brms_RRi.R
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
#!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
if (length(args)!=0){
print(class(args))
}
# load necessary library files
if (!require("pacman")) install.packages("pacman")
library(pacman)
p_load(readr)
p_load(dplyr)
source("getBRMModel.R")
physio<-read_rds("physio.rds")
names<-c(1:12)
formulas<-list("Value~1",
"Value~1+(1|Spielfeld)",
"Value~1+(1|BiopacSubject)",
"Value~1+Factor1 + (1|BiopacSubject)",
"Value~1+Factor2 + (1|BiopacSubject)",
"Value~1+Factor2+ betweenCond + (1|BiopacSubject)",
"Value~1+Factor2 * betweenCond + (1|BiopacSubject)",
"Value~1+Factor2 * betweenCond+ Time + (1|BiopacSubject)",
"Value~1+Factor2 * betweenCond* Time + (1|BiopacSubject)",
"Value~1+Factor1+Factor2 * betweenCond + Time + (1|BiopacSubject)",
"Value~1+Factor1*Factor2 + betweenCond + Time + (1|BiopacSubject)",
"Value~1+Factor1*Factor2 * betweenCond + Time + (1|BiopacSubject)"
)
measurement<-list("RRi")
models<-lapply(measurement,function(x,y){within(y,measurement<-x)},y= data_frame(formulas,names)) %>% bind_rows()
models <- split(models, seq(nrow(models)))
est_model<-lapply(models[args],function(x,y){getBRMModel(dataframe = x,data=y,path = "models/")},y=physio)