un peu de nettoyage, mais rien de fou
[valse.git] / src / test / generate_test_data / generateRunSaveTest_EMGLLF.R
CommitLineData
99b372ae
BA
1generateRunSaveTest_EMGLLF = function(n=200, p=15, m=10, k=3, mini=5, maxi=10,
2 gamma=1., lambda=0.5, tau=1e-6)
3{
4 testFolder = "data/"
5 dir.create(testFolder, showWarnings=FALSE, mode="0755")
99b372ae 6
9ade3f1b 7 require(valse)
ef67d338
BA
8 params = valse:::basicInitParameters(n, p, m, k)
9 xy = valse:::generateXYdefault(n, p, m, k)
c3bc4705
BA
10
11 #save inputs
e8bb4764
BA
12 write.table(as.double(params$phiInit), paste(testFolder,"phiInit",sep=""),
13 row.names=F, col.names=F)
14 write.table(as.double(params$rhoInit), paste(testFolder,"rhoInit",sep=""),
15 row.names=F, col.names=F)
16 write.table(as.double(params$piInit), paste(testFolder,"piInit",sep=""),
17 row.names=F, col.names=F)
18 write.table(as.double(params$gamInit), paste(testFolder,"gamInit",sep=""),
19 row.names=F, col.names=F)
20 write.table(as.integer(mini), paste(testFolder,"mini",sep=""),
21 row.names=F, col.names=F)
22 write.table(as.integer(maxi), paste(testFolder,"maxi",sep=""),
23 row.names=F, col.names=F)
24 write.table(as.double(gamma), paste(testFolder,"gamma",sep=""),
25 row.names=F, col.names=F)
26 write.table(as.double(lambda), paste(testFolder,"lambda",sep=""),
27 row.names=F, col.names=F)
ef67d338 28 write.table(as.double(xy$X), paste(testFolder,"X",sep=""),
e8bb4764 29 row.names=F, col.names=F)
ef67d338 30 write.table(as.double(xy$Y), paste(testFolder,"Y",sep=""),
e8bb4764
BA
31 row.names=F, col.names=F)
32 write.table(as.double(tau), paste(testFolder,"tau",sep=""),
33 row.names=F, col.names=F)
ef67d338 34 write.table(as.integer(c(n,p,m,k)), paste(testFolder,"dimensxyns",sep=""),
e8bb4764 35 row.names=F, col.names=F)
99b372ae
BA
36
37 res = EMGLLF(params$phiInit,params$rhoInit,params$piInit,params$gamInit,mini,maxi,
ef67d338 38 gamma,lambda,xy$X,xy$Y,tau)
99b372ae
BA
39
40 #save outputs
e8bb4764
BA
41 write.table(as.double(res$phi), paste(testFolder,"phi",sep=""), row.names=F, col.names=F)
42 write.table(as.double(res$rho), paste(testFolder,"rho",sep=""), row.names=F, col.names=F)
43 write.table(as.double(res$pi), paste(testFolder,"pi",sep=""), row.names=F, col.names=F)
44 write.table(as.double(res$LLF), paste(testFolder,"LLF",sep=""), row.names=F, col.names=F)
45 write.table(as.double(res$S), paste(testFolder,"S",sep=""), row.names=F, col.names=F)
99b372ae 46}