fix generateRunTest for constructionModelesEMGrank; remove man pages (will be roxygen...
[valse.git] / src / test / generate_test_data / generateRunSaveTest_constructionModelesLassoMLE.R
CommitLineData
c3bc4705
BA
1generateRunSaveTest_constructionModelesLassoMLE = function(n=200, p=15, m=10, k=3, mini=5,
2 maxi=10, gamma=1.0, glambda=list(0.0,0.01,0.02,0.03,0.05,0.1,0.2,0.3,0.5,0.7,0.85,0.99))
3{
ef67d338
BA
4 tau = 1e-6;
5 seuil = 1e-15;
6 L = length(glambda);
dc425209 7 A1 = array(0, dim=c(p, m+1, L))
ef67d338 8 A2 = array(0, dim=c(p, m+1, L))
c3bc4705
BA
9 for (i in 1:L)
10 {
c3bc4705 11 A1[,1,i] = seq_len(p)
ef67d338
BA
12 A1[1:5,2,i] = seq_len(5)
13 A2[,1,i] = seq_len(p)
14 A2[1:5,2,i] = seq_len(5)
dc425209 15 }
ef67d338
BA
16 require(valse)
17 params = valse:::basicInitParameters(n, p, m, k)
18 xy = valse:::generateXYdefault(n, p, m, k)
c3bc4705 19
ef67d338
BA
20 testFolder = "data/"
21 dir.create(testFolder, showWarnings=FALSE, mode="0755")
c3bc4705
BA
22 #save inputs
23 write.table(as.double(params$phiInit), paste(testFolder,"phiInit",sep=""),
24 row.names=F, col.names=F)
25 write.table(as.double(params$rhoInit), paste(testFolder,"rhoInit",sep=""),
26 row.names=F, col.names=F)
27 write.table(as.double(params$piInit), paste(testFolder,"piInit",sep=""),
28 row.names=F, col.names=F)
29 write.table(as.double(params$gamInit), paste(testFolder,"gamInit",sep=""),
30 row.names=F, col.names=F)
31 write.table(as.integer(mini), paste(testFolder,"mini",sep=""),
32 row.names=F, col.names=F)
33 write.table(as.integer(maxi), paste(testFolder,"maxi",sep=""),
34 row.names=F, col.names=F)
35 write.table(as.double(gamma), paste(testFolder,"gamma",sep=""),
36 row.names=F, col.names=F)
37 write.table(as.double(lambda), paste(testFolder,"lambda",sep=""),
38 row.names=F, col.names=F)
ef67d338 39 write.table(as.double(xy$X), paste(testFolder,"X",sep=""),
c3bc4705 40 row.names=F, col.names=F)
ef67d338
BA
41 write.table(as.double(xy$Y), paste(testFolder,"Y",sep=""),
42 row.names=F, col.names=F)
43 write.table(as.double(seuil), paste(testFolder,"seuil",sep=""),
c3bc4705
BA
44 row.names=F, col.names=F)
45 write.table(as.double(tau), paste(testFolder,"tau",sep=""),
46 row.names=F, col.names=F)
ef67d338
BA
47 write.table(as.double(A1), paste(testFolder,"A1",sep=""),
48 row.names=F, col.names=F)
49 write.table(as.double(A2), paste(testFolder,"A2",sep=""),
50 row.names=F, col.names=F)
51 write.table(as.integer(c(n,p,m,k,L)), paste(testFolder,"dimensions",sep=""),
c3bc4705
BA
52 row.names=F, col.names=F)
53
54 res = constructionModelesLassoMLE(
55 params$phiInit,params$rhoInit,params$piInit,params$gamInit,
ef67d338 56 mini,maxi,gamma,glambda,xy$X,xy$Y,seuil,tau,A1,A2)
c3bc4705 57
dc425209 58 #save output
c3bc4705
BA
59 write.table(as.double(res$phi), paste(testFolder,"phi",sep=""), row.names=F, col.names=F)
60 write.table(as.double(res$rho), paste(testFolder,"rho",sep=""), row.names=F, col.names=F)
61 write.table(as.double(res$pi), paste(testFolder,"pi",sep=""), row.names=F, col.names=F)
62 write.table(as.double(res$llh), paste(testFolder,"llh",sep=""), row.names=F, col.names=F)
dc425209 63}