[R] problems using the thin plate spline method

Mintewab Bezabih Mintewab.Bezabih at economics.gu.se
Mon Dec 5 22:55:58 CET 2011


Dear Michael and R users,

I generated a more orderly looking data again and below are the data and the codes I am trying to run.

many thanks
mintewab

dat <- read.table("E:/thin plate/thin plate.csv", header=T, sep=",")
names(dat) <- c("x1", "x2", "y")
library(fidelds)
plot (dat)
plot (dat$x1, dat$x2)
#load the fields package (containing Tps) and fit a thin plate spline
tpsfit <- Tps(cbind(dat$x1, dat$x2), dat$y, scale.type="unscaled")



         x1     x2       y
1    409.50  673.0 1082.50
2    349.00  335.0  684.00
3    385.50 1737.0 2122.50
4    273.00  457.0  730.00
5    543.00 2325.0 2868.00
6    746.00 1255.0 2001.00
7    198.75  388.0  586.75
8    262.50  104.0  366.50
9    320.50  786.0 1106.50
10   259.00  516.0  775.00
11   399.50  542.0  941.50
12   595.50  916.0 1511.50
13   374.00 1257.0 1631.00
14   293.00  229.0  522.00
15   330.00  490.0  820.00
16   658.00 1016.0 1674.00
17   299.00  266.0  565.00
18   775.00 1139.0 1914.00
19   559.75 1023.0 1582.75
20   251.00  153.0  404.00
21   402.00  253.0  655.00
22   395.50  319.0  714.50
23   345.50  456.0  801.50
24   283.50  400.0  683.50
25   452.00  388.0  840.00
26   816.50  941.0 1757.50
27   266.50  307.0  573.50
28   360.25  683.0 1043.25
29   386.00  528.0  914.00
30   160.25  368.0  528.25
31   360.00  455.0  815.00
32   337.00  488.0  825.00
33   326.00  702.0 1028.00
34   758.00 1040.0 1798.00
35   342.50  405.0  747.50
36   389.00  483.0  872.00
37   347.50  524.0  871.50
38   819.25  490.0 1309.25
39   355.25  517.0  872.25
40   281.00  505.0  786.00
41   494.50  844.0 1338.50
42   514.50  429.0  943.50
43   263.00  349.0  612.00
44   439.00  549.0  988.00
45   263.00  450.0  713.00
46   373.25 1212.0 1585.25
47   546.00  546.0 1092.00
48   348.00  485.0  833.00
49   380.50  378.0  758.50
50   606.00  598.0 1204.00
51   460.00  838.0 1298.00
52   352.50  519.0  871.50
53   737.00  624.0 1361.00
54   275.00  185.0  460.00
55   520.50  632.0 1152.50
56   385.25  696.5 1081.75
57   354.50  524.0  878.50
58   383.50  618.0 1001.50
59   322.50  381.0  703.50
60   309.00  380.0  689.00
61   502.50  624.0 1126.50
62   517.00  612.0 1129.00
63   276.00  260.0  513.00
64   400.50  831.0 1231.50
65   272.50  451.0  723.50
66       NA  284.0      NA
67   253.00  353.0  606.00
68   311.00  720.0 1031.00
69   389.00  583.0  972.00
70   157.75  344.0  501.75
71   520.00 1175.0 1695.00
72   499.50  761.0 1260.50
73   481.00  694.0 1275.00
74   448.50  606.0 1054.50
75   335.50  239.0  574.50
76   231.50  273.0  504.50
77   492.50  394.0  886.50
78   477.50  899.0 1376.50
79   650.00  721.0 1371.00
80   540.75  730.0 1270.75
81   620.50 1295.0 1915.50
82   400.50 1148.0 1548.50
83   331.50  524.0  855.50
84   311.00  578.0  889.00
85   229.00  262.0  491.00
86   432.50  326.0  758.50
87   422.75  217.0  639.75
88   493.50  648.0 1141.50
89   414.25  485.0  899.25
90   487.00  726.0 1213.00
91   369.00  747.0 1116.00
92   425.00 1663.0 2088.00
93   233.50  269.0  502.50
94   254.50  488.5  743.00
95   417.50 1137.0 1554.50
96       NA  310.0      NA
97   583.25  434.0 1017.25
98   492.50  536.0 1028.50
99   490.00  486.0  976.00
100  300.25 1225.0 1525.25
101      NA  462.0      NA
102  270.00  237.0  507.00
103  307.00  230.0  537.00
104  319.00  242.0  561.00
105  374.50  340.0  714.50
106  562.50  521.0 1083.50
107  569.50  242.0  811.50
108  389.75  389.0  778.75
109  341.25  691.0 1032.25
110  366.00  387.0  753.00
111  262.75  615.0  877.75
112  776.25 1926.0 2702.25
113  379.50  597.0  976.50
114  360.00  299.0  659.00
115  203.75  213.0  416.75
116  517.00  618.0 1135.00
117  539.50  684.0 1223.50
118  418.75  439.0  857.75
119  353.50  459.0  812.50
120  269.00  366.0  635.00
121  475.50 1098.0 1573.50
122  472.00  384.0  856.00
123  342.00  488.0  830.00
124  189.00  181.0  370.00
125  492.50 5342.0 5834.50
126  412.00  433.0  845.00
127  467.50 1475.0 1942.50
128  209.75  480.0  689.75
129  340.75  207.0  547.75
130  231.50  153.0  384.50
131  185.50  295.0  480.50
132  358.50  524.0  882.50
133  354.00  453.0  807.00
134  670.50  978.0 1648.50
135  686.00  486.0 1172.00
136  364.00  676.0 1040.00
137  138.00  336.0  474.00
138  272.00  254.0  526.00
139  183.00  273.0  456.00
140  365.25  255.0  620.25
141  188.00  347.0  535.00
142  229.50  420.0  649.50
143  553.50  603.0 1156.50
144  582.50  739.0 1321.50
145  469.00  340.0  809.00
146  359.50  572.0  931.50
147  284.25  441.0  725.25
148  582.50  833.0 1415.50
149  287.00  775.0 1062.00
150      NA  129.0      NA
151  455.25  350.0  805.25
152  410.50 1445.0 1855.50
153  477.00  328.0  805.00
154  239.00  585.0  824.00
155  313.50  412.0  725.50
156  294.50  446.0  740.50
157  523.00  679.0 1202.00
158  372.50  519.0  891.50
159  231.50  372.0  603.50
160      NA 1712.0      NA
161  365.00  167.0  532.00
162  269.50  492.0  761.50
163  394.50  593.0  987.50
164  281.50  210.0  491.50
165  418.50  363.0  781.50
166  553.50  630.0 1183.50
167  245.75  261.0  506.75
168  304.00  869.0 1173.00
169  423.75  676.0 1099.75
170  369.50  253.0  622.50
171  330.50  923.0 1253.50
172  278.00  791.0 1069.00
173  257.00  415.0  672.00
174  416.50  349.0  765.50
175  413.25  825.0 1238.25
176  465.50  486.0  951.50
177  877.25  508.0 1385.25
178  204.00  191.0  395.00
179  475.00  282.0  757.00
180  289.00  267.0  556.00
181  425.75  372.0  797.75
182  405.00  639.0 1044.00
183  494.25  687.0 1181.25
184  332.00 1427.0 1759.00
185  552.50  847.0 1399.50
186  433.75  368.0  801.75
187  821.00  616.0 1437.00
188  841.50 1723.0 2564.50
189  226.50  310.0  536.50
190  266.75  449.0  715.75
191  552.00  301.0  853.00
192  157.50  378.0  535.50
193  528.50  573.0 1101.50
194  248.50  273.0  521.50
195  245.50  405.0  650.50
196  303.00  653.0  956.00
197  444.25  606.0 1050.25
198  310.00  943.0 1253.00
199  768.25  926.0 1694.25
200  265.50  399.0  664.50
201   98.25  282.0  380.25
202  525.00 1112.0 1637.00
203  407.75  484.0  891.75
204  163.50  408.0  571.50
205  374.25  434.0  808.25
206  749.00  595.0 1344.00
207  318.50  223.0  541.50
208  367.00  517.0  884.00
209  250.00  323.0  573.00
210  408.00  353.0  761.00
211  341.50  628.0  969.50
212  266.50  334.0  600.50
213  348.50  502.0  850.50
214  398.50  861.0 1259.50
215  429.50  361.0  790.50
216  420.00  464.0  884.00
217  263.50  285.0  548.50
218  581.50  693.0 1274.50
219  509.50  129.0  610.50
220  724.75  817.0 1541.75
221  476.50  516.0  992.50
222  249.50  291.0  540.50
223  297.50  211.0  508.50
224  245.00  232.0  477.00
225  139.50  269.0  408.50
226  360.50  378.0  738.50
227  983.50 2560.5 3544.00
228  465.50  662.0 1127.50
229  263.75  580.0  843.75
230      NA  531.0      NA
231  510.00 1334.0 1844.00
232  325.00  384.0  709.00
233  122.50  217.0  339.50
234  455.50  714.0 1169.50
235  531.00  766.0 1297.00
236  318.00  648.0  966.00
237  373.00  288.0  661.00
238  487.00  722.0 1209.00
239  401.00  917.0 1318.00
240  451.75  359.0  810.75
241  561.00  576.0 1137.00
242  364.50  383.0  747.50
243  439.50  546.0  985.50
244  733.50 1379.0 2112.50
245  455.00  622.0 1077.00
246  376.50  201.0  577.50
247  554.00  549.0 1103.00
248  409.50  575.0  984.50
249 1007.50 1416.0 2423.50
250  462.50  496.0  958.50
251  183.00  111.0  294.00
252  342.50  406.0  748.50
253  304.00  519.0  823.00
254  258.25  294.0  552.25
255  380.50  343.0  723.50
256  373.00  437.0  810.00
257  683.00  972.0 1655.00
258  577.00 1403.0 1980.00
259  430.00  471.0  901.00
260  324.25  368.0  692.25
261  312.00  459.0  771.00
262  389.00  617.0 1006.00
263  345.00  444.0  789.00
264  358.50  312.0  670.50
265  551.75  963.0 1514.75
266  317.50  315.0  632.50
267  499.00  549.0 1048.00
268  335.50 1022.0 1357.50
269  450.50  423.0  873.50
270  363.50  384.0  747.50
271  185.00  195.0  380.00
272  177.50  265.0  442.50
273  477.75  827.0 1304.75
274  644.50  827.0 1471.50
275  290.25  309.0  599.25
276  457.50  546.0 1003.50
277  295.50  385.0  680.50
278  266.50  380.0  646.50
279  348.50  422.0  770.50
280  357.75  188.0  545.75
281  221.50  378.0  599.50
282  739.00  772.0 1511.00
283  445.50  233.0  678.50
284  416.00  339.0  755.00
285  261.50  952.0 1213.50
286  909.00 1336.0 2245.00
287  737.50 1740.0 2477.50
288  194.50  256.0  450.50
289  438.50  772.0 1210.50
290  358.00  462.0  820.00
291  244.00  254.0  498.00
292  388.50  243.0  631.50
293  512.50  332.0  844.50
294  315.25  871.0 1186.25
295  572.00  562.0 1134.00
296  473.75 1761.0 2234.75
297  627.50  689.0 1316.50
298  507.75  623.0 1130.75
299  281.00  286.0  567.00
300  511.50  233.0  744.50
301  309.25  668.0  977.25
302  308.25 1078.0 1386.25
303  690.00  682.0 1372.00
304  180.00  169.0  349.00
305  341.50  437.0  778.50
306  273.00  943.0 1216.00
307  571.00  724.0 1295.00
308  694.00  614.0 1308.00
309  345.00  439.0  784.00
310  497.00  344.0  841.00
311  219.00  297.0  516.00
312  311.50  384.0  695.50
313  458.50  569.0 1027.50
314  283.00  187.0  470.00
315  274.00  498.0  772.00
316  282.50  335.0  617.50
317  187.50  339.0  526.50
318  332.00  289.0  621.00
319  281.75  431.0  712.75
320  397.75  549.0  946.75
321  336.50  334.0  670.50
322  392.50  482.0  874.50
323  318.00  363.0  681.00
324  609.50  663.0 1272.50
325  203.50  192.0  395.50
326  144.50   60.0  204.50
327  504.75  468.0  972.75
328  647.00  582.0 1229.00
329  374.00  365.0  739.00
330  149.50  479.0  658.50
331  319.00  983.0 1302.00
332  306.00  668.0  974.00
333  304.75  605.0  909.75
334  304.50  231.0  535.50
335  247.00  457.0  704.00
336  329.00  469.0  798.00
337  442.00  664.0 1106.00
338  308.00  490.0  798.00
339  316.00  274.0  590.00
340  219.00  580.0  799.00
341  556.50  476.0 1032.50
342  643.50  385.0 1028.50
343  328.50  302.0  630.50
344  301.00  607.0  908.00
345  467.00 1723.0 2190.00
346  452.50  441.0  893.50
347  351.50  463.0  814.50
348  373.00  229.0  602.00
349  503.50  138.0  641.50
350  287.50  279.0  566.50
351  393.50  245.0  638.50
352  444.00 1081.0 1525.00
353  734.00 1080.0 1814.00
354  458.50 1745.0 2203.50
355 1182.00 1157.0 2339.00
356  406.00  338.0  744.00
357  286.50  571.0  857.50
358  283.50  211.0  494.50
359  642.50 2256.0 2898.50
360  453.50  778.0 1231.50
361  206.00  224.0  430.00
362  258.00  158.0  416.00
363  412.00  393.0  805.00
364  551.00  661.5 1212.50
365  784.75 4828.0 5612.75
366  316.50  478.0  794.50
367  326.50  687.0 1013.50
368  202.25  497.0  699.25
369  336.75  244.0  580.75
370  406.00  455.0  861.00
371  225.50  390.0  615.50
372  266.00  271.0  537.00
373  916.50  849.0 1765.50
374  387.00  316.0  703.00
375  496.25  785.0 1281.25
376  389.00  464.0  853.00
377  668.50  509.0 1177.50
378  192.00  338.0  530.00
379  396.00  567.0  963.00
380  282.50  726.0 1008.50
381  414.50  742.0 1156.50
382  355.00  515.0  870.00
383  294.50  245.0  539.50
384  396.50  501.0  897.50
385  348.75  359.0  707.75
386  241.75  220.0  461.75
387  347.50  555.0  902.50
388  250.00  424.0  674.00
389  473.50  592.0 1065.50
390  369.00 1470.0 1839.00
391  672.00  441.0 1113.00
392  199.50  177.0  376.50
393  318.25 1302.0 1620.25
394  219.75  245.0  464.75
395  124.00  429.0  553.00
396  514.25  597.0 1111.25
397  600.50  809.0 1409.50
398  256.00  835.0 1091.00
399  574.75 1548.0 2122.75
400  346.25  568.0  914.25
401  397.00  310.0  707.00
402  195.00  218.0  413.00
403  494.00  904.0 1398.00
404  567.50 1276.0 1843.50
405  431.50  538.0  969.50
406  144.50  315.0  459.50
407  440.00  526.0  966.00
408  525.50  604.0 1129.50
409  375.50  506.0  881.50
410  841.50 1836.0 2677.50
411  386.25  365.0  751.25
412  490.50  889.0 1379.50
413  296.50  508.0  804.50
414  812.25  446.0 1258.25
415  385.00  999.0 1384.00
416  232.50  392.0  624.50
417  239.25  189.0  428.25
418  316.50  377.0  693.50
419  312.25  335.0  647.25
420  257.75  214.0  471.75
421      NA  469.0      NA
422  389.00  530.0  919.00
423  301.50  197.0  498.50
424  242.25  630.0  872.25
425  400.25  814.0 1214.25
426  367.25 1305.0 1672.25
427  321.50  932.0 1253.50
428  301.00  753.0 1054.00
429  223.00  361.0  584.00
430  360.00 1139.0 1499.00
431  662.50  639.0 1301.50
432  407.50  908.0 1315.50
433  736.00 1535.0 2271.00
434  379.50  483.0  862.50
435  852.00  786.0 1638.00
436  355.00  476.0  831.00
437  397.00  467.0  864.00
438  527.50  703.0 1230.50
439  531.25  830.0 1361.25
440  473.00  565.0 1038.00
441  559.75  883.0 1442.75
442  344.00 1569.0 1913.00
443  379.75 1071.0 1450.75
444  459.00  261.0  720.00
445  322.00  564.0  886.00
446  208.50  645.0  853.50
447  424.25  365.0  789.25
448  342.25  587.0  929.25
449  414.50  585.0  999.50
450  308.00  395.0  703.00
451  574.50  673.0 1247.50
452  635.00  940.0 1575.00
453  449.50 1002.0 1451.50
454  286.00  225.0  511.00
455  986.25 1311.0 2297.25
456  563.50  471.0 1034.50
457  596.00  629.0 1225.00
458  492.00  433.0  925.00
459  265.00  213.0  478.00
460  826.50 1335.0 2161.50
461  557.00  662.0 1219.00
462  387.50  565.0  952.50
463  531.50 1028.0 1559.50
464  464.00  442.0  906.00
465  582.00  548.0 1130.00
466  354.50  418.0  772.50
467  382.75  741.0 1123.75
468  833.00  798.0 1631.00
469  347.25  482.0  829.25
470  615.25  595.0 1210.25
471  389.00  362.0  751.00
472  354.25  580.0  934.25
473  564.00  953.0 1517.00
474  890.50 1057.0 1947.50
475  168.00  171.0  339.00
476  467.25  834.0 1301.25
477  554.50  466.0 1020.50
478  296.00  861.0 1157.00
479  744.50 1624.0 2368.50
480  387.25  648.0 1035.25
481  393.25  394.0  787.25
482  331.00 1008.0 1339.00
483  391.00  626.0 1017.00
484  274.00  442.0  716.00
485  707.75  530.0 1237.75
486  467.50  716.0 1183.50
487  160.50  211.0  371.50
488  569.50  960.5 1530.00
489  340.50  511.0  851.50
490  259.00  335.0  594.00
491  321.75  452.0  773.75
492  286.25  661.0  947.25
493  416.50  303.0  719.50
494  459.25  411.0  870.25
495  276.50  336.0  612.50
496  280.25  681.0  961.25
497  258.50  450.0  708.50
498  309.50  346.0  655.50
499  424.50  417.0  841.50
500  365.00  458.0  823.00
501  809.00 1313.0 2122.00
502  238.75  795.0 1033.75
503  524.00  529.0 1053.00
504  563.50  203.0  766.50
505  419.00  699.0 1118.00
506  354.50  500.0  854.50
507  303.00  282.0  585.00
508  167.50  339.0  506.50
509  236.25  479.0  715.25
510  268.00  361.0  629.00
511  330.50  330.0  660.50
512  251.50  366.0  617.50
513  249.00  169.0  418.00
514  443.50  882.0 1325.50
515  411.50 3209.0 3620.50
516  323.50  225.0  548.50
517  485.25 1158.0 1643.25
518  356.50  701.0 1057.50
519  221.50  316.0  537.50
520  515.50  646.0 1161.50
521  462.00  682.0 1144.00
522  322.50  414.0  736.50
523  602.50  869.0 1471.50
524  446.25  761.0 1207.25
525  489.75  645.0 1134.75
526  396.50  641.0 1037.50
527      NA  669.0      NA
528  222.50  260.0  482.50
529  365.50 1155.0 1520.50
530  386.00  908.0 1294.00
531  286.00  878.0 1164.00
532  448.00  609.0 1057.00
533  379.75  519.0  898.75
534  293.50  313.0  606.50
535  410.00  527.0  937.00
536  335.50  511.0  846.50
537  444.50  538.0  982.50
538  464.75  339.0  803.75
539  364.25  803.0 1167.25
540  360.00  232.0  592.00
541  589.00  773.0 1362.00
542  546.50 1739.0 2285.50
543  470.00  567.0 1037.00
544  304.50  248.0  552.50
545      NA 1375.0      NA
546  501.50 1340.0 1841.50
547  459.50  456.0  915.50
548  715.00 1470.0 2185.00
549  349.00  459.0  808.00
550  285.00  480.0  765.00
551  268.00  396.0  664.00
552  507.50  566.0 1073.50
553  441.50  668.0 1109.50
554  188.50  555.0  743.50
555  186.50  198.0  384.50
556  679.00 1479.0 2158.00
557  249.00  229.0  478.00
558  200.00  227.0  427.00
559  419.50  500.0  919.50
560  294.25  560.0  854.25
561  596.00  927.0 1523.00
562  395.75  412.0  807.75
563  314.75  403.0  717.75
564  412.50  397.0  809.50
565  363.75  527.0  890.75
566  218.50  385.0  603.50
567  208.50  381.0  589.50
568  535.50  582.0 1117.50
569  309.75  539.0  848.75
570  336.00  426.0  762.00
571  217.00  361.0  578.00
572  245.50 1212.0 1457.50
573  608.75  624.0 1232.75
574  375.00  469.0  844.00
575  555.50  294.0  849.50
576  621.00 1194.0 1815.00
577  488.50  620.0 1108.50
578  271.50  234.0  505.50
579  331.50  446.0  777.50
580  286.00  177.0  463.00
581  555.00  893.0 1448.00
582  345.00  489.0  834.00
583  529.50  426.0  955.50
584  370.00  699.0 1069.00
585  584.25  539.0 1123.25
586  208.50  486.0  694.50
587  473.50  887.0 1360.50
588  244.00  321.0  565.00
589  296.25  235.0  531.25
590  598.00  501.0 1099.00
591  456.25  586.0 1042.25
592  371.00  509.0  880.00
593  505.50  687.0 1192.50
594  269.50  520.0  789.50
595  284.00  820.0 1104.00
596  420.75  758.0 1178.75
597  358.25  441.0  799.25
598  476.75  876.0 1352.75
599  363.00  661.0 1024.00
600  485.75  638.0 1123.75
601  570.00  512.0 1082.00
602  567.25  518.0 1085.25
603  355.50  695.0 1050.50
604  444.00  397.0  841.00
605  629.00  179.0  808.00
606  367.50  450.0  817.50
607  174.50   98.0  272.50
608  217.00   94.0  311.00
609  239.00  100.0  339.00
610  378.50  216.0  594.50
611  179.50   86.0  265.50
612  188.00  149.0  337.00
613  355.00  338.0  693.00
614  304.50  324.0  628.50
615  354.50  460.0  814.50
616  207.50  124.0  331.50
617  615.00  375.0  990.00
618  163.50  255.0  418.50
619  374.00  356.0  730.00
620  316.50  263.0  579.50
621   79.00   64.0  143.00
622  409.00  374.0  783.00
623  218.25  477.0  695.25
624  452.00  664.0 1116.00
625  398.00  370.0  768.00
626  277.50  416.0  693.50
627  289.25  416.0  705.25
628  491.00  741.0 1232.00
629  515.00 1136.0 1651.00

________________________________________
Fr?n: R. Michael Weylandt <michael.weylandt at gmail.com> [michael.weylandt at gmail.com]
Skickat: den 5 december 2011 14:04
Till: Mintewab Bezabih
Kopia: Jeff Newmiller; Sarah Goslee; r-help at r-project.org
?mne: Re: [R] problems using the thin plate spline method

Your data was scrubbed by the server. Use dput() to create a plain text representation of dat you can put in the body of the email.

Michael

On Dec 5, 2011, at 6:54 AM, Mintewab Bezabih <Mintewab.Bezabih at economics.gu.se> wrote:

> Dear Jeff and R users,
>
> Thanks Jeff.
>
> Your first plot suggestion worked. And when I stick dat$x1, dat$x2,dat$y, tpsfit seems to work as well. But it gives me a new error message
>
> tpsfit <- Tps(cbind(dat$x1, dat$x2), dat$y, scale.type="unscaled")
>
> Warning message:
> In gcv.Krig(out, nstep.cv = nstep.cv, verbose = verbose, cost = out$cost,  :
>  Value of pure error estimate  is outside possible range
>
> Then I get error messages for the subsequent lines as well.
>
> I have now attached the data. And here is the full code I am trying to run.
>
>
> dat <- read.table("E:/thin plate/thin plate.csv", header=T, sep=",")
> names(dat) <- c("x1", "x2", "y")
> library(fields)
> plot (dat)
>
> #load the fields package (containing Tps) and fit a thin plate spline
> tpsfit <- Tps(cbind(dat$x1, dat$x2), dat$y, scale.type="unscaled")
>
> #predict the thin plate spline on the fine grid and plot the fitting
> ngrid <- length(xf); grid <- cbind(rep(xf, ngrid), rep(xf, rep(ngrid, ngrid)))
> out.p1 <- predict(tpsfit, grid)
>
>
> persp(xf, xf, matrix(out.p1, ngrid, ngrid, byrow=F), theta=130, phi=20,
>      expand=0.45, xlab="x1", ylab="x2", zlab="y", xlim=c(0,1), ylim=c(0,1),
>      zlim=range(zf), ticktype="detailed", scale=F, main="gcv fitting")
>
> Many thanks once again.
>
> regards
> mintewab
>
>
>
> Fr?n: Jeff Newmiller [jdnewmil at dcn.davis.ca.us]
> Skickat: den 5 december 2011 12:39
> Till: Mintewab Bezabih; Sarah Goslee
> Kopia: r-help at r-project.org
> ?mne: Re: [R] problems using the thin plate spline method
>
> Try
>
> plot( dat$x1, dat$y )
>
> or
>
> plot( x1, y, data=dat )
>
> Note that your example is still not reproducible because you have not supplied the data or a shortened version of your data for us to work with. Also, your problem is not with thin plates but with plot, and reading the help for that function by typing
>
> ?plot
>
> at the R command line would have provided you with more examples and usage info on how to get around this problem.
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                      Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> Mintewab Bezabih <Mintewab.Bezabih at economics.gu.se> wrote:
>
>> Dear Sarah and R users,
>>
>> Sorry again for not being explicit enough. Here is my full problem
>>
>>
>> dat <- read.table("E:/thin plate/thin plate.csv", header=T, sep=",")
>> dat
>> names(dat) <- c("x1", "x2", "y")
>> library(fields)
>> plot (dat)
>>
>> #load the fields package (containing Tps) and fit a thin plate spline
>> tpsfit <- Tps(cbind(x1, x2), y, scale.type="unscaled")
>>
>> What I meant when I said the graph works is when I do plot(dat) it does
>> plot of all my three variables. If I do plot(x1,y), though, I get the
>> 'object x1 not found' error message.
>>
>> Same when I do the next line tpsfit <- Tps(cbind(x1, x2), y,
>> scale.type="unscaled"). I get the same error message.
>>
>> I tried your suggestion of checking str(x1) and I get the same error
>> message (object x1 not found).
>> I also typed ls() and I get "dat" after that command.
>>
>> I followed the r tutorial guide to read my data and I am following the
>> r tutorial to guide me to apply the thin plate spline method.
>>
>> Regards,
>>
>> Mintewab
>> ________________________________________
>> Fr?n: Sarah Goslee [sarah.goslee at gmail.com]
>> Skickat: den 4 december 2011 15:21
>> Till: Mintewab Bezabih
>> Kopia: r-help at r-project.org
>> ?mne: Re: [R] problems using the thin plate spline method
>>
>> Hello,
>>
>> On Sun, Dec 4, 2011 at 8:08 AM, Mintewab Bezabih
>> <Mintewab.Bezabih at economics.gu.se> wrote:
>>> Dear R users and Jeff,
>>>
>>> Sorry for not being quite explicit in my earlier message.
>>
>> And you are still not explicit. We have no idea what you've done.
>>
>>> My main problem is while my data seem to be read into R well (I
>> manage to graph them and all), I cannot get the following line to work.
>>>
>>> tpsfit <- Tps(cbind(x1, x2), y, scale.type="unscaled")
>>>
>>> and I get the following error message
>>>
>>> Error in as.matrix(x) :
>>> error in evaluating the argument 'x' in selecting a method for
>> function 'as.matrix': Error: object 'x1' not found
>>
>> I'd have to guess that there's no object x1. What does ls() tell you?
>> str(x1)?
>>
>> What do your data look like? You were already given instructions on how
>> to
>> include sample data to construct a reproducible example. You said that
>> graphing your data worked; how did you do so?
>>
>> The posting guide and the advice you were already given were both
>> offered for a reason. The querent needs to do the work of formulating
>> an understandable and answerable question.
>>
>> Sarah
>>
>>> thanks for help
>>> minti
>>> ________________________________________
>>> Fr?n: Jeff Newmiller [jdnewmil at dcn.davis.ca.us]
>>> Skickat: den 3 december 2011 17:45
>>> Till: Mintewab Bezabih; r-help at r-project.org
>>> ?mne: Re: [R] problems using the thin plate spline method
>>>
>>> I can tell that you are puzzled and confused. Unfortunately, I am not
>> psychic, so I cannot tell what you did, and therefore cannot tell where
>> you went astray.
>>>
>>> The solution is for you to read the posting guide mentioned at the
>> bottom of every R-help message. Spend a little time to create a small
>> bit of data like yours if your actual data is large (subset and dput
>> are useful for this). Remember to include the output of sessionInfo,
>> and so on. Many times you are likely to find the answer yourself by
>> going through these steps, but they are essential for communication.
>>>
>>> Good luck.
>>> Sent from my phone. Please excuse my brevity.
>>>
>>> Mintewab Bezabih <Mintewab.Bezabih at economics.gu.se> wrote:
>>>
>>>> Dear R users,
>>>>
>>>> I am a beginner in R trying to apply the thin plate spline method to
>> my
>>>> climate data. I used the example in R to do so, and the lines seem to
>>>> run fine ( I am not getting errors) but I am not getting any output
>> in
>>>> the form of graph or anything. I got a warning message saying that
>>>> 'surface extends beyond box'.
>>>>
>>>> Any help is much appreciated.
>>>> thanks
>>>> minti
>>
>>
>> --
>> Sarah Goslee
>> http://www.functionaldiversity.org
>>
>> ______________________________________________
>> R-help at 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.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list