Hi, Does anyone have an example of a Markov Random Field smoother (MRF) in MGCV where they have specified the neighbourhood directly, rather than supplying polygons? Does anyone understand how the rules should be? Based on the columb example, I have setup my data set and neighbourhood like so:
> head(nb.l) $`10/10` [1] 135 155 153 $`10/2` [1] 27 8 6 $`10/3` [1] 48 7 28 26 $`10/4` [1] 69 27 49 47 $`10/5` [1] 48 70 68 $`10/7` [1] 115 95 93 > head(obs) x y truth x.idx y.idx xy.idx 24 1.4835147 0.8026673 2.3605204 13 10 13/10 26 1.0452111 0.4673685 1.8316741 11 8 11/8 43 2.1514977 -0.2640058 -2.8812026 17 5 17/5 46 2.8473951 0.5445714 3.6347799 20 9 20/9 53 1.7983253 -0.6905912 -2.5473984 15 3 15/3 86 -0.1839814 -0.7824026 -0.5776616 5 2 5/2 > but get the following error: > mdl <- gam(truth ~ s(xy.idx,bs="mrf",xt=list(nb=nb.l)),data=obs,method="REML") Error in smooth.construct.mrf.smooth.spec(object, dk$data, dk$knots) : mismatch between nb/polys supplied area names and data area names However, there is a perfect match between the nb list names and the data area names: > all(levels(obs$xy.idx) %in% names(nb.l)) [1] TRUE > Any suggestions where to start? Mark [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.