fix valse pkg functions callings in src/test/generate
[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")
6 delimiter = " "
7
8 #save inputs
9ade3f1b
BA
9 require(valse)
10 params = valse:::basic_Init_Parameters(n, p, m, k)
99b372ae
BA
11 io = generateIOdefault(n, p, m, k)
12 write.table(paste(testFolder,"phiInit",sep=""), params$phiInit, sep=delimiter);
13 write.table(paste(testFolder,"rhoInit",sep=""), params$rhoInit, sep=delimiter);
14 write.table(paste(testFolder,"piInit",sep=""), params$piInit, sep=delimiter);
15 write.table(paste(testFolder,"gamInit",sep=""), params$gamInit, sep=delimiter);
16 write.table(paste(testFolder,"mini",sep=""), mini, sep=delimiter);
17 write.table(paste(testFolder,"maxi",sep=""), maxi, sep=delimiter);
18 write.table(paste(testFolder,"gamma",sep=""), gamma, sep=delimiter);
19 write.table(paste(testFolder,"lambda",sep=""), lambda, sep=delimiter);
20 write.table(paste(testFolder,"X",sep=""), io$X, sep=delimiter);
21 write.table(paste(testFolder,"Y",sep=""), io$Y, sep=delimiter);
22 write.table(paste(testFolder,"tau",sep=""), tau, sep=delimiter);
23 write.table(paste(testFolder,"dimensions",sep=""), c(n,p,m,k), sep=delimiter);
24
25 res = EMGLLF(params$phiInit,params$rhoInit,params$piInit,params$gamInit,mini,maxi,
26 gamma,lambda,io$X,io$Y,tau);
27
28 #save outputs
29 write.table(paste(testFolder,"phi",sep=""), res$phi, sep=delimiter);
30 write.table(paste(testFolder,"rho",sep=""), res$rho, sep=delimiter);
31 write.table(paste(testFolder,"pi",sep=""), res$pi, sep=delimiter);
32 write.table(paste(testFolder,"LLF",sep=""), res$LLF, sep=delimiter);
33 write.table(paste(testFolder,"S",sep=""), res$S, sep=delimiter);
34}