Commit | Line | Data |
---|---|---|
31463ab8 | 1 | source("EMGLLF.R") |
825cf55f | 2 | |
99b372ae BA |
3 | generateRunSaveTest_EMGLLF = function(n=200, p=15, m=10, k=3, mini=5, maxi=10, |
4 | gamma=1., lambda=0.5, tau=1e-6) | |
5 | { | |
825cf55f | 6 | testFolder = "../data/" |
99b372ae | 7 | dir.create(testFolder, showWarnings=FALSE, mode="0755") |
99b372ae | 8 | |
9ade3f1b | 9 | require(valse) |
ef67d338 BA |
10 | params = valse:::basicInitParameters(n, p, m, k) |
11 | xy = valse:::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 | |
f7244815 | 39 | res = EMGLLF_R(params$phiInit,params$rhoInit,params$piInit,params$gamInit,mini,maxi, |
ef67d338 | 40 | gamma,lambda,xy$X,xy$Y,tau) |
99b372ae BA |
41 | |
42 | #save outputs | |
e8bb4764 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$LLF), paste(testFolder,"LLF",sep=""), row.names=F, col.names=F) | |
47 | write.table(as.double(res$S), paste(testFolder,"S",sep=""), row.names=F, col.names=F) | |
99b372ae | 48 | } |