dattel_palme [via R]
2014-Jan-05 20:59 UTC
[R] delicate problem with permutation test and raster images
Hello! I want to make a permutation test between two variables, whereas the dependent variable is a set of raster images (remote sensing index). In total, I only have 7 observation dates. As this is a very small number, a permutation test enables to simulate a high number of observations and obtain a more robust statistic. - I am interested in getting the p-value from a correlation between the two variables. The important thing: The output should be a raster image with every pixel holding a prober value. Data Overview: independent variable (single value) dependent variable (raster image) x1 y1 - y1<-raster(raster image), raster func. in raster package x2 y2 x3 y3 x4 y4 x5 y5 x6 y6 x7 y7 One raster image contains i rows and j columns. The permutation hast to be executed for every single pixel during all obervation dates, in other words seven values from every single pixel (one per observation date) have to be permuted by the seven values of the independent variable x. This process has to be repeated for every single pixel. It is important to keep the pixels, as the output should be a map, where every pixel is assigned the p-value (from the statistic). So far I used the 'lmp' function from the lmPerm package. Therefore, all data have to be in one table. I ordered every pixel side by side to the one pixel before and obtained the entire number of pixels in one row (pixel number= number of columns). For every observation date I made one row resulting in 7 rows. The first column was reserved for the independent variable x. V1 V2 V3 V4... date1: x1 px1 px2 px3... date2: x2 px1 px2 px3... ... date7: x7 px1 px2 px3... I then did the permutation test using 'lmp': permutationTest <- lmp (V243606~V1, data=tableOfData, sep="", header=TRUE) # here for the pixel in row243606 summary(permutationTest) the Problem: the test has to be done for every singel pixel and i have more than 1 million of it! that is not possible. I tried another method using the raster package: Raster package has the calc function, which allows to apply any formula to every single pixel. E.g. I introduced the formula for the Pearson correlation coefficient and the density function for a student t-distribution to get the p-value into the 'calc' function. I was thinking to introduce the 'lmp' formula into the 'calc' function, but was not successful as I have to use 7 raster images and 7 numeric values, that this function does not take. Does anybody know how to solve this problem? I will very much appreciate any help for this problem! Thanks! ______________________________________ If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/delicate-problem-with-permutation-test-and-raster-images-tp4683123.html This email was sent by dattel_palme (via Nabble) To receive all replies by email, subscribe to this discussion: http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=subscribe_by_code&node=4683123&code=ci1oZWxwQHItcHJvamVjdC5vcmd8NDY4MzEyM3wtNzg0MjM1NTA4 [[alternative HTML version deleted]]