test auto-indenter
[valse.git] / test / generateRunSaveTest_EMGLLF.R
CommitLineData
086ca318 1source("helper.R")
a3105972 2library(valse)
825cf55f 3
99b372ae
BA
4generateRunSaveTest_EMGLLF = function(n=200, p=15, m=10, k=3, mini=5, maxi=10,
5 gamma=1., lambda=0.5, tau=1e-6)
6{
9a73b966 7 testFolder = "data/"
99b372ae 8 dir.create(testFolder, showWarnings=FALSE, mode="0755")
99b372ae 9
321e13a9
BA
10 params = basicInitParameters(n, p, m, k)
11 xy = generateXYdefault(n, p, m, k)
c3bc4705
BA
12
13 #save inputs
e8bb4764
BA
14 write.table(as.double(params$phiInit), paste(testFolder,"phiInit",sep=""),
15 row.names=F, col.names=F)
16 write.table(as.double(params$rhoInit), paste(testFolder,"rhoInit",sep=""),
17 row.names=F, col.names=F)
18 write.table(as.double(params$piInit), paste(testFolder,"piInit",sep=""),
19 row.names=F, col.names=F)
20 write.table(as.double(params$gamInit), paste(testFolder,"gamInit",sep=""),
21 row.names=F, col.names=F)
22 write.table(as.integer(mini), paste(testFolder,"mini",sep=""),
23 row.names=F, col.names=F)
24 write.table(as.integer(maxi), paste(testFolder,"maxi",sep=""),
25 row.names=F, col.names=F)
26 write.table(as.double(gamma), paste(testFolder,"gamma",sep=""),
27 row.names=F, col.names=F)
28 write.table(as.double(lambda), paste(testFolder,"lambda",sep=""),
29 row.names=F, col.names=F)
ef67d338 30 write.table(as.double(xy$X), paste(testFolder,"X",sep=""),
e8bb4764 31 row.names=F, col.names=F)
ef67d338 32 write.table(as.double(xy$Y), paste(testFolder,"Y",sep=""),
e8bb4764
BA
33 row.names=F, col.names=F)
34 write.table(as.double(tau), paste(testFolder,"tau",sep=""),
35 row.names=F, col.names=F)
825cf55f 36 write.table(as.integer(c(n,p,m,k)), paste(testFolder,"dimensions",sep=""),
e8bb4764 37 row.names=F, col.names=F)
99b372ae 38
a3105972
BA
39 res = valse::EMGLLF(params$phiInit,params$rhoInit,params$piInit,params$gamInit,mini,
40 maxi,gamma,lambda,xy$X,xy$Y,tau,fast=FALSE)
99b372ae
BA
41
42 #save outputs
a3105972
BA
43 write.table(as.double(res$phi),paste(testFolder,"phi",sep=""),row.names=F,col.names=F)
44 write.table(as.double(res$rho),paste(testFolder,"rho",sep=""),row.names=F,col.names=F)
45 write.table(as.double(res$pi),paste(testFolder,"pi",sep=""),row.names=F,col.names=F)
46 write.table(as.double(res$llh),paste(testFolder,"llh",sep=""),row.names=F,col.names=F)
47 write.table(as.double(res$S),paste(testFolder,"S",sep=""),row.names=F,col.names=F)
48 write.table(as.integer(res$affec),paste(testFolder,"affec",sep=""),row.names=F,col.names=F)
99b372ae 49}