Browse files

Comparison tmb vs admb of 4 examples: mvrw sdv_multi spatial nmix

* consistency between example parameter order
* consistency between example names
* fixed mvrw data difference
* compare - more details
  • Loading branch information...
1 parent 00a635e commit 13efae3048d6310a6a6eb0e974f1270a5b508d55 @kaskr committed Jan 24, 2014
View
2 admb_examples/Makefile
@@ -1,4 +1,4 @@
-examples=nmix mvrw
+examples=nmix mvrw spatial sdv_multi
outputfiles = $(examples:=.output.RData)
all: $(outputfiles)
%.output.RData :
View
200 admb_examples/mvrw/mvrw.dat
@@ -1,102 +1,102 @@
100
3
-0.968826991395459 0.513151096037443 -1.65609699652806
--1.18956272451604 0.937455517216558 -1.26333114620449
--0.032594106089003 0.620522685813152 0.0954654661839042
-0.481261750059896 -0.344800992049762 -4.34521445831169
--2.0509555029681 -1.44547032386203 -3.18398491464913
--1.1271464542278 -3.62220476961151 -6.73770101900149
-0.0555807165946364 -2.12554968200785 -5.79330212181159
--1.9395455044392 -2.36930863702918 -6.05359628379077
--1.90463661001989 -2.61840436908097 -7.54861164880723
--3.4045384825216 -4.35733054835403 -9.01443399291425
--3.23172747999142 -7.97679674779115 -13.4714219876516
--0.584123019285052 -5.5662953766454 -10.4846258768729
--2.75113919997529 -6.62737855668315 -11.1865448200109
--3.18796941785201 -4.82525600977826 -12.9818629473986
--3.49692504635674 -6.40325754969986 -12.2971435650354
--2.30609581910338 -5.19020246533343 -10.6747654968233
--3.02814833851662 -5.89160262208411 -8.77609988383953
--0.541289925088544 -3.68956780035239 -6.06970424302325
--3.3768457228971 -3.83255642332947 -8.06540442345889
--3.08164965759773 -4.41481742048348 -7.26057613983382
--3.07050923850541 -4.96026619760344 -5.09783310306587
--3.29153018557499 -4.65298333842437 -6.26667182189409
--4.37567019769306 -5.03755530654994 -7.56376269301283
--1.696774149291 -5.58713682667974 -6.23000205028934
--1.87794279190303 -4.11214904562526 -5.31722562727948
--3.06662944651863 -4.69901560966745 -5.65426923852005
--0.804248833250711 -3.3854277747733 -6.94421087233976
--1.20000483127364 -5.29388785008182 -10.0652871601668
--2.89020109479793 -4.73679181683309 -8.36832087209745
--0.638391955550289 -3.91704633689045 -6.41839267633252
--3.81508710536062 -3.61622673016225 -5.13651043599701
--3.81813929461319 -5.39262210021334 -7.64695401916275
--3.997808795887 -3.24786856413666 -7.45396366414129
--1.29139134792594 -3.40160073221018 -7.66114832509085
--1.85023531539952 -3.75157710394226 -1.76837113170854
--3.8432226649823 -2.69753438757079 -0.35135165178934
--2.02768684688517 -4.77398443228978 -1.49868491094309
--0.0385831218518498 -2.5562220545741 -1.93048339566311
--5.03373960109011 -3.0434761918835 -0.103316857139165
--3.19148953069456 -1.27135778588117 -0.574823180092355
--3.353689926865 -2.23395138647875 -3.76896002350669
--1.19938388047649 -2.64862557899368 -0.329975168149157
--0.877024919933614 -5.10700870475126 -0.0688851453428678
--2.3267332647566 -3.28973209749737 -0.606123217485688
--3.98478015836545 -4.99914031473496 -5.77540838793287
--0.258700792367272 -4.31849657401887 -3.11915334974298
--1.38248233250676 -2.04858313370171 0.0343571698154806
--3.82607941485949 -4.06861960298256 -1.39331181179101
--2.89986004531112 -3.85984919517104 -4.43090978758605
--2.97660628764185 -5.94134667038613 -6.81582704204611
--4.15438781697647 -4.91618723620517 -6.9672357860571
--3.76932797873185 -5.69478766014528 -8.44162821160204
--2.70489275205159 -6.57487296245861 -7.8890781175557
--1.60298909949095 -4.35173313027621 -6.95209412379295
--3.28567442807377 -6.60043630773592 -5.27455515095568
--1.70148200363392 -5.20701696176647 -4.88632793939834
--4.05949585433509 -4.98894760229125 -8.56856322438423
--5.3685269481556 -4.7300063110111 -8.26456965043549
--3.75218463690038 -6.78848668534412 -9.47490256842141
--5.57484823436666 -10.6533989677589 -12.5091056555557
--5.11362260007125 -6.84728233899166 -6.28657805188597
--6.54606882665678 -7.83697926607458 -7.86270787573286
--5.02380225590271 -6.41222845955187 -6.67284787412596
--4.05703750600826 -7.96980457657295 -5.67786267279451
--5.66435590361671 -9.81199369659791 -8.98202758384333
--6.20527877751481 -9.56880941289313 -11.597310226475
--6.45543602723318 -9.82512293671373 -11.9447553259773
--7.4316662855135 -10.5305834265796 -13.0178268560084
--6.94452610275552 -10.122902720573 -16.5061145347958
--7.56412270729967 -12.4726313858302 -12.9001576071673
--9.55345510884192 -11.5770378534022 -15.9949878719019
--7.73009938582692 -12.3232367903035 -14.0094224110442
--6.48906585236277 -8.00930447443268 -11.4874233608466
--4.44438832267165 -8.48510181582766 -9.19507016619742
--6.35950288787734 -7.29170069524348 -13.4111028366408
--7.90760135392482 -9.61159595659635 -13.0531810732835
--5.78467089669663 -8.29503894700036 -12.3852377742953
--6.69000646556899 -9.91513094606563 -16.2828438003233
--9.57263777684526 -10.9897706712847 -19.2069186256603
--7.97160139916792 -10.5504452764959 -22.6238706936603
--8.27365190402471 -8.62780566127572 -19.6717763722715
--7.45100766206055 -11.3763557221513 -19.7278820893261
--8.07549427909936 -9.54977663151922 -21.3004167812943
--7.22443451073361 -11.08395060174 -21.0475098907416
--8.14963427923173 -10.0697350040894 -23.8408773731389
--6.75154920221663 -8.85664830947904 -17.6587966906818
--5.56534471064655 -8.88317152792043 -16.6878051694216
--8.1123458279699 -7.5244068438253 -13.9963478731616
--5.77905381269559 -7.87352306072578 -16.9665507998104
--6.16173201874105 -8.66447110861012 -20.2401821885662
--7.2305781613286 -7.72295959428237 -19.0908686804355
--7.03786285383218 -7.85472878397858 -17.7690808266728
--7.35655314266628 -9.65264725383655 -14.573578881394
--6.52537458476614 -5.86293040581472 -15.0885672246052
--6.66460823153035 -6.96141565129701 -12.1768039625637
--6.58176396397079 -4.91396749739328 -9.93536580532037
--8.25977649507485 -8.16369489251398 -11.5139117450503
--7.14372873062333 -9.02335990173059 -14.0270334159343
--8.21540107565624 -7.55656411018367 -16.4361256952926
--7.90653704012729 -6.23895294391257 -11.8088450214177
+0.9688269913954591 0.5131510960374428 -1.656096996528063
+-1.160406501735954 0.7882167318628006 -1.211111071241255
+-0.04327977607492178 0.7586207737229205 -0.009533982454155265
+0.5002229817231403 -0.4257099143242834 -4.405968939225009
+-2.039395894438798 -1.680395023336056 -3.243227787277589
+-1.118026812146449 -4.183274160282207 -6.794112948172764
+0.08482568827294124 -2.56661702078619 -5.859625631334448
+-1.910238298199178 -3.024120199248523 -6.075094219517958
+-1.842434800122521 -3.283584706116631 -7.512549329060263
+-3.299357960078017 -5.486835071261003 -8.832461352732205
+-3.126713518339395 -9.690020412967167 -13.27484403256301
+-0.4258380756594766 -6.902887451787357 -10.20381973016938
+-2.645150834598211 -8.089557075165345 -10.96076213693413
+-3.10946118260164 -6.285474257176347 -12.79383197055955
+-3.3925143972244 -8.010092175920668 -12.08464073376584
+-2.14359224798753 -6.704047260751856 -10.38798866335974
+-2.898050445632711 -7.079435094911583 -8.53500350309284
+-0.4141613021570345 -4.670070006713799 -5.823491468169587
+-3.215072746313783 -5.005740585791272 -7.701023797974968
+-2.935885577198376 -5.52176129019144 -6.923532312383089
+-2.887873976602133 -6.013815562517396 -4.673617932041118
+-3.121961572774387 -5.697986649990883 -5.843849872564065
+-4.246433726647021 -6.131745658922784 -7.239976510756329
+-1.600700785819686 -6.548980935741182 -5.910360748345643
+-1.760131529734117 -4.722084903617189 -5.062372644338361
+-2.957271682895847 -5.425465820848132 -5.396300192292828
+-0.7424997403085074 -4.352599400425462 -6.716743021488509
+-1.129261099038795 -6.580459388279431 -9.768056834665904
+-2.771039222519761 -5.958501914101514 -8.064080278410504
+-0.5043506585688733 -5.040370340333362 -6.121135339807811
+-3.643068687545642 -4.479824532763934 -4.783158386912397
+-3.682811667643127 -6.588750832535932 -7.332619396107851
+-3.857149358235221 -4.325186840565964 -7.086320569770883
+-1.15617118135513 -4.554879279853477 -7.316999331024083
+-1.620676981382117 -4.452800190720144 -1.275448582929108
+-3.608118294719219 -3.386276146954303 0.1696743803446279
+-1.815232283770021 -5.310680025402245 -1.06630431530065
+0.1462219225965018 -2.938447482044221 -1.523166366125046
+-4.860226870313721 -3.505151343156573 0.325819670950927
+-3.010334090078888 -1.703527972858133 -0.1542065132817247
+-3.142374738999883 -2.891265088889493 -3.273530270750361
+-0.9957559919261894 -3.160135754019024 0.1443121927721453
+-0.6675322958929948 -5.576573595955265 0.3863746052079811
+-2.113952462372069 -3.81443942759771 -0.1790077687308287
+-3.780201683870161 -5.972788744506037 -5.315392519695648
+-0.05705242907864561 -5.262530530989327 -2.632412840233761
+-1.172528778468306 -2.483585858037919 0.5563270687206228
+-3.653015825063158 -4.807138910267328 -0.9067120784797164
+-2.707261609154235 -4.76447056668199 -3.872059449966986
+-2.774849613041479 -7.282228684806654 -6.235773841217545
+-3.951107450294712 -6.391969048004531 -6.455783671600272
+-3.568815802394138 -7.237840587441847 -7.888644728455053
+-2.52156337004923 -7.971944935943179 -7.383850059381968
+-1.375646837062475 -5.429711869705147 -6.427064973759632
+-3.054032094605805 -7.827780775315194 -4.714035157824237
+-1.519700493671599 -6.278875801056283 -4.433348626895659
+-3.888518152210833 -6.302594934022033 -8.106904074656171
+-5.248015083571035 -6.128908782273975 -7.814755337961751
+-3.554974356607919 -8.458701143121715 -8.895099776854412
+-5.389460143660052 -12.76688343963325 -11.87360749910227
+-4.889791858025947 -8.393984746371988 -5.581308490899022
+-6.319659385218643 -9.591378317762635 -7.112292983659588
+-4.816551157494149 -7.978324559506537 -5.930630130430056
+-3.784860115288793 -9.57240640020872 -4.819868044337191
+-5.437906811742827 -11.73554003193878 -8.113310506166785
+-5.947850504357286 -11.8346150222513 -10.67934116391267
+-6.217329158661177 -12.50183272987571 -11.00933199621606
+-7.209354990193616 -13.04436740080788 -12.11249562178244
+-6.756078662025949 -12.9663442309573 -15.63546202969525
+-7.339857935705029 -15.19903611279129 -12.00077109358818
+-9.35753603131991 -14.62522379958199 -15.13201875466744
+-7.560173179286084 -14.93509345956954 -13.21038868081949
+-6.301753021602015 -10.22858275141371 -10.70370011244354
+-4.243375842728179 -10.58378973290733 -8.371753910706625
+-6.270060351424532 -9.310726909065647 -12.78568745561448
+-7.853664183898136 -11.85184194573639 -12.45903511808121
+-5.811239746891696 -10.57174800841652 -11.92608349946815
+-6.705478511370293 -12.53222719075628 -15.77366002533929
+-9.57903318327355 -14.0446193635313 -18.61084922822014
+-8.015517796981589 -13.8676282997198 -22.10701780782665
+-8.357949902217401 -11.80619697592728 -19.23382747213751
+-7.600021570848485 -14.493615829725 -19.35667793591169
+-8.14807116114976 -12.38705466326047 -20.93838377194816
+-7.322202233478779 -13.96165914835316 -20.74185152386768
+-8.231541348996725 -13.29937323138375 -23.41632887294435
+-6.865533973386756 -11.42578939085304 -17.31495804864288
+-5.673252821304493 -11.37266478887089 -16.32113424823211
+-8.210930994974788 -9.80521408067966 -13.62252046329925
+-5.89842011828067 -10.35165200549642 -16.57464207783225
+-6.305455491573994 -11.50652472939532 -19.88798390352042
+-7.352856554521882 -10.47029909459836 -18.71931790048665
+-7.181321045718782 -10.49310366589339 -17.3612283437372
+-7.477845471922413 -11.96625345195378 -14.20515026734491
+-6.68085001257062 -8.046462275034164 -14.7554988514606
+-6.790356260196533 -9.05441934454549 -11.77390546055848
+-6.663907110244621 -6.789304657979137 -9.485067770009778
+-8.322443838755593 -10.31964628187613 -10.91744365701058
+-7.157283594859253 -11.65118997660504 -13.30603871150205
+-8.257793757889321 -10.24403984436942 -15.76276669572682
+-7.93162848232723 -8.453711647107193 -11.09830099727014
View
8 admb_examples/mvrw/mvrw.pin
@@ -0,0 +1,8 @@
+# transf_rho
+0.1
+# logsds
+0 0 0
+# logsdObs
+0 0 0
+# u
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
View
40 admb_examples/mvrw/mvrw.tpl
@@ -4,31 +4,34 @@ GLOBALS_SECTION
DATA_SECTION
init_int N
init_int stateDim
- init_matrix obss(1,N,1,stateDim)
+ init_matrix obs(1,N,1,stateDim)
PARAMETER_SECTION
- objective_function_value jnll;
- init_bounded_number rho(0.001,0.999,1);
- init_vector logSdObs(1,stateDim);
- init_vector logSd(1,stateDim);
- random_effects_vector U(1,stateDim*N);
+ objective_function_value jnll;
+ init_number transf_rho;
+ init_vector logsds(1,stateDim);
+ init_vector logsdObs(1,stateDim);
+ random_effects_vector u(1,stateDim*N);
PROCEDURE_SECTION
-
- for(int t=1; t<=(N-1); t++)
- step(t,U((t-1)*stateDim+1,t*stateDim),U(t*stateDim+1,(t+1)*stateDim),logSd,rho);
for(int t=1; t<=(N-1); t++)
- obs(t,U((t-1)*stateDim+1,t*stateDim),logSdObs);
+ step(t,u((t-1)*stateDim+1,t*stateDim),u(t*stateDim+1,(t+1)*stateDim),logsds,transf_rho);
+
+ for(int t=1; t<=(N); t++)
+ obsfun(t,u((t-1)*stateDim+1,t*stateDim),logsdObs);
-SEPARABLE_FUNCTION void step(const int t, const dvar_vector& u1,const dvar_vector& u2, const dvar_vector& logSd, const dvariable& rho)
+SEPARABLE_FUNCTION void step(const int t, const dvar_vector& u1,const dvar_vector& u2, const dvar_vector& logsds, const dvariable& transf_rho)
dvar_matrix fvar(1,stateDim,1,stateDim);
dvar_matrix fcor(1,stateDim,1,stateDim);
dvar_vector fsd(1,stateDim);
+ dvariable rho=2.0/(1.0+exp(-2.0*transf_rho))-1.0;
fvar.initialize();
- fsd = exp(logSd);
+ fsd = exp(logsds);
- dvar_vector a=u1.shift(1);
- dvar_vector b=u2.shift(1);
+ dvar_vector a=u1;
+ dvar_vector b=u2;
+ a=a.shift(1);
+ b=b.shift(1);
for(int i=1; i<=stateDim; ++i){
for(int j=1; j<=stateDim; ++j){
@@ -40,12 +43,13 @@ SEPARABLE_FUNCTION void step(const int t, const dvar_vector& u1,const dvar_vecto
jnll+=nLogNormal(a,b,fvar);
-SEPARABLE_FUNCTION void obs(const int t, const dvar_vector& u, const dvar_vector& logSdObs)
- dvar_vector var = exp(2.0*logSdObs);
- dvar_vector pred = u.shift(1);
+SEPARABLE_FUNCTION void obsfun(const int t, const dvar_vector& u, const dvar_vector& logsdObs)
+ dvar_vector var = exp(2.0*logsdObs);
+ dvar_vector pred = u;
+ pred=pred.shift(1);
for(int i=1; i<=stateDim; i++){
//cout << i << endl;
- jnll+=0.5*(log(2.0*M_PI*var(i))+square(obss(t,i)-pred(i))/var(i));
+ jnll+=0.5*(log(2.0*M_PI*var(i))+square(obs(t,i)-pred(i))/var(i));
}
TOP_OF_MAIN_SECTION
View
19 compare/report.R
@@ -8,23 +8,34 @@ compare <- function(example){
setwd("../admb_examples")
load(paste0(example,".output.RData"))
setwd("../tmb_examples")
- load(paste0(example,".expected.RData"))
+ load(paste0(example,".output.RData"))
+ sum <- summary(.results$`TMB::sdreport`)
+ rep <- rep[1:nrow(sum),] ## In case admb example has sdreport - we don't compare that yet
ok <- all(as.character(rep$name)==rownames(sum))
if(!ok){
cat("Example:",example,"\n")
cat("Sdreport names must match between the two examples.\n")
+ cat("TMB example:\n")
+ print(table(rownames(sum)))
+ cat("ADMB example:\n")
+ print(table(rep$name))
stop()
}
- sum <- summary(.results$`TMB::sdreport`)
- diff <- sum-rep[,3:4]
+ nfixed <- nrow(summary(.results$`TMB::sdreport`,"fixed")) ## number of fixed effects
+ ##diff <- sum-rep[,3:4]
+ i <- 1:nfixed
+ diff <- sum[i,]-rep[i,3:4] ## Only compare fixed effects
res <- apply(abs(diff),2,max)
names(res) <- c("Max norm est-diff","Max norm sd-diff")
+ diff <- sum[-i,]-rep[-i,3:4] ## Only compare random effects
+ resrf <- apply(abs(diff),2,max)
+ names(resrf) <- c("Max norm rfest-diff","Max norm rfsd-diff")
tim <- as.numeric(.timings$`TMB::sdreport`["elapsed"])
tot <- sum(sapply(.timings,function(x)x["elapsed"]))
res2 <- c("tmb est time"=tot-tim,"tmb sdrep time"=tim)
res3 <- c("admb est time"=as.numeric(tim1["elapsed"]),
"admb sdrep time"=as.numeric(tim2["elapsed"]-tim1["elapsed"]))
- c(res,res2,res3)
+ c(res,resrf,res2,res3)
}
t(sapply(examples,compare))
View
4 tmb_examples/rw.R → tmb_examples/mvrw.R
@@ -31,7 +31,7 @@ stateDim=3
timeSteps=100
simdata()
library(TMB)
-dyn.load("rw.so")
+dyn.load("mvrw.so")
data <- list(obs=t(obs))
parameters <- list(
u=data$obs*0,
@@ -40,7 +40,7 @@ parameters <- list(
logsdObs=sdObs*0
)
newtonOption(smartsearch=FALSE)
-obj <- MakeADFun(data,parameters,random="^u",DLL="rw")
+obj <- MakeADFun(data,parameters,random="^u",DLL="mvrw")
obj$fn()
obj$gr()
View
6 tmb_examples/rw.cpp → tmb_examples/mvrw.cpp
@@ -9,10 +9,10 @@ template<class Type>
Type objective_function<Type>::operator() ()
{
DATA_ARRAY(obs); /* timeSteps x stateDim */
- PARAMETER_ARRAY(u); /* State */
PARAMETER(transf_rho);
PARAMETER_VECTOR(logsds);
PARAMETER_VECTOR(logsdObs);
+ PARAMETER_ARRAY(u); /* State */
int timeSteps=obs.dim[1];
int stateDim=obs.dim[0];
Type rho=f(transf_rho);
@@ -27,10 +27,10 @@ Type objective_function<Type>::operator() ()
MVNORM_t<Type> neg_log_density(cov);
/* Define likelihood */
Type ans=0;
- ans-=dnorm(vector<Type>(u.col(0)),Type(0),Type(1),1).sum();
+ // ans-=dnorm(vector<Type>(u.col(0)),Type(0),Type(1),1).sum();
for(int i=1;i<timeSteps;i++)
ans+=neg_log_density(u.col(i)-u.col(i-1)); // Process likelihood
- for(int i=1;i<timeSteps;i++)
+ for(int i=0;i<timeSteps;i++)
ans-=dnorm(vector<Type>(obs.col(i)),vector<Type>(u.col(i)),sdObs,1).sum(); // Data likelihood
return ans;
}
View
BIN tmb_examples/mvrw.expected.RData
Binary file not shown.
View
4 tmb_examples/rw_sparse.R → tmb_examples/mvrw_sparse.R
@@ -31,7 +31,7 @@ stateDim=3
timeSteps=100
simdata()
library(TMB)
-dyn.load("rw_sparse.so")
+dyn.load("mvrw_sparse.so")
data <- list(obs=t(obs))
parameters <- list(
u=data$obs*0,
@@ -40,7 +40,7 @@ parameters <- list(
logsdObs=sdObs*0
)
newtonOption(smartsearch=FALSE)
-obj <- MakeADFun(data,parameters,random="^u",DLL="rw_sparse")
+obj <- MakeADFun(data,parameters,random="^u",DLL="mvrw_sparse")
obj$fn()
obj$gr()
View
0 tmb_examples/rw_sparse.cpp → tmb_examples/mvrw_sparse.cpp
File renamed without changes.
View
0 tmb_examples/rw_sparse.expected.RData → tmb_examples/mvrw_sparse.expected.RData
File renamed without changes.
View
BIN tmb_examples/rw.expected.RData
Binary file not shown.
View
1 tmb_examples/sdv_multi.R
@@ -31,3 +31,4 @@ ttt=system.time(opt<-nlminb(obj$par,obj$fn,obj$gr,
##obj$gr()
#c(phi1,phi2)
#f(opt$par)
+rep <- sdreport(obj)
View
BIN tmb_examples/sdv_multi.expected.RData
Binary file not shown.
View
6 tmb_examples/spatial.cpp
@@ -19,16 +19,16 @@ Type objective_function<Type>::operator() ()
Type res=0;
vector<Type> eta(n);
- eta = X*b + u;
+ eta = X*b + exp(log_sigma)*u;
//
matrix<Type> cov(n,n);
for (i=0;i<n;i++)
{
- cov(i,i)=sigma2;
+ cov(i,i)=Type(1);
for ( j=0;j<i;j++)
{
- cov(i,j)=sigma2*exp(-a*dd(i,j)); // Exponentially decaying correlation
+ cov(i,j)=exp(-a*dd(i,j)); // Exponentially decaying correlation
cov(j,i)=cov(i,j);
}
}
View
BIN tmb_examples/spatial.expected.RData
Binary file not shown.

0 comments on commit 13efae3

Please sign in to comment.