```
store<-function(model,nomodel,vertex,df,ydata){
if (min(df[vertex,])>0){
y=ydata[vertex,]
model=lmer(y~group+time+sex_+(1|id_),REML= FALSE)
nomodel=lmer(y~group+time+sex_+group*time+(1|id_),REML= FALSE)
a=anova(model,nomodel)
a_[vertex]=a
print(a)
#plot(model,select=c(1))
coefs=data.frame(coef(summary(model)))
df.KR=get_ddf_Lb(model,fixef(model))
coefs$p.KR=2*(1-pt(abs(coefs$t.value),df.KR))
print(coefs)
p[1,vertex]=coefs$p.KR[1]
p[2,vertex]=coefs$p.KR[2]
p[3,vertex]=coefs$p.KR[3]
p[4,vertex]=coefs$p.KR[4]
p[5,vertex]=coefs$p.KR[5]
p[6,vertex]=coefs$p.KR[6]
p<-p
model_list[vertex]=model
betaVec[vertex]=fixef(model)[3]
groupdiff[vertex]=fixef(model)[2]
interaction[vertex]=fixef(model)[5]
sexeff[vertex]=fixef(model)[4]
sex_time[vertex]=fixef(model)[6]
}else betaVec[vertex]=NA
groupdiff[vertex]=NA
interaction[vertex]=NA
sexeff[vertex]=NA
sex_time[vertex]=NA
p[1,vertex]=NA
p[2,vertex]=NA
p[3,vertex]=NA
p[4,vertex]=NA
p[5,vertex]=NA
p[6,vertex]=NA
}
```

I use it for neuroimaging and I want to save in the matrix as I am able to do in matlab parfor