Thin Plate Spline for 3D surface prediction in R -
i tried answer
but hasn't helped. perform tps (using tps fields{}) on xyz dataframe xy co-orinates , z thickness. visualise plot firstly before tps , after tps..? possible. extract predicted thicknesses given set of new xy co-ordinates..?
please let me know if possible
my dataframe looks this, dataframe called lsp:
time part meas partsub xloc yloc xxxx 1 1.956 -3465 -94350 xxxx 1 1.962 -3465 -53850 xxxx 1 1.951 50435 -40350 xxxx 1 1.958 -57365 -40350
so tried this:
lsp.spline <- tps(lsp[,5:6], lsp$meas) out.p <- predict.surface(lsp.spline, xy = c(1,2)) plot.surface(out.p, type="p")
but out.p null..?
so attempting plot gives me:
error in nrow(z) : argument "z" missing, no default
any appreciated. paul.
predict.surface
obsolete / deprecated function. use predictsurface
instead.
fit<- tps( bd[,1:4], bd$lnya) # fit surface data # evaluate fitted surface first 2 # variables holding other 2 fixed @ median values out.p<- predictsurface(fit) surface(out.p, type="c")
thanks - how second question....how can extract predicted surface thickness values given set of xy locations..?
use predict
function. have read on ?predict.tps
. above example, let's want predict @ first 4 locations in bd[, 1:4]
, can do
predict(fit, x = bd[1:4, 1:4]) # [,1] #[1,] 11.804124 #[2,] 11.804124 #[3,] 8.069056 #[4,] 9.501551
in general, pass x
two-column matrix.
Comments
Post a Comment