Hi R-user, I was trying to compute probability of species distribution using MaxEnt. the MaxEnt uses only teh sites in which species present, I tried to run but did not work, would you give me some hints?
I have given an example table and how I tried it. --------------------------------------------------- install.packages("maxent", dependencies=TRUE) install.packages("dismo", dependencies=TRUE) library(dismo) library(maxent) dd<-structure(list(long = c(-75.747, -106.84, -105.27, -104.64, -103.71, -102.72, -101.79, -100.8, -105.69, -104.67, -103.71, -102.69, -101.66, -100.71, -99.685, -98.656, -97.627, -111.82, -110.2, -109.55, -106.88, -106.84, -105.85, -104.82, -103.84, -102.8, -101.83, -100.79, -99.742, -98.695, -97.744, -112.46, -111.8, -110.79, -108.41, -107.74), lat = c(19.792, 21.576, 21.347, 21.243, 21.078, 21.185, 20.99, 21.067, 22.621, 22.763, 22.594, 22.704, 22.797, 22.581, 22.642, 22.685, 22.711, 24.153, 23.44, 23.385, 23.4, 23.702, 23.565, 23.71, 23.542, 23.654, 23.454, 23.533, 23.596, 23.64, 23.377, 24.796, 24.459, 24.399, 24.503, 24.429 ), sp1 = c(0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 0L), sp2 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L), sp3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), sp4 = c(0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), env1 = c(182.0037689, 163.3301239, 443.0214233, 1240.155273, 1774.867432, 1909.528809, 2153.244141, 1878.018433, 909.1315308, 1980.898438, 2271.118896, 2122.672852, 2033.41626, 1534.658447, 828.4759522, 222.3117523, 23.4761219, 79.52642822, 322.994751, 273.6637268, 35.5085907, 516.3795776, 2205.419434, 2118.727539, 2178.901123, 1995.210083, 2048.075928, 1824.84021, 1043.509888, 184.4526062, 12.6928978, 20.87172508, 126.5344544, 258.8852844, 3.28964257, 140.3287811 ), env2 = c(1134L, 550L, 2111L, 2523L, 2156L, 1209L, 1107L, 2605L, 3176L, 2490L, 1360L, 801L, 1118L, 1484L, 2730L, 1309L, 104L, 197L, 2033L, 1339L, 567L, 2694L, 2708L, 1806L, 1344L, 912L, 1377L, 2346L, 3265L, 989L, 69L, 428L, 764L, 896L, 100L, 1521L), env3 = c(24.533, 24.928, 24.707, 21.052, 21.318, 18.428, 19.041, 17.743, 24.371, 19.689, 16.879, 16.528, 16.901, 18.015, 20.648, 25.31, 24.308, 22.528, 22.912, 22.001, 25.097, 25.391, 19.154, 14.943, 17.143, 16.898, 16.891, 17.563, 15.63, 24.354, 24.088, 22.527, 22.528, 22.126, 25.317, 25.643), env4 = c(0.047969, 0.003469, 0.003385, 0.002253, 0.000791, 0.001834, 0.008016, 0.009262, 0.003934, 0.002322, 0.00061, 0.000799, 6.4e-05, 0, 0, 0.000107, 0.003151, 0.018915, 0.015077, 0.004554, 0.003499, 0.002705, 0.003507, 0.001173, 0.000149, 0.000308, 0, 0, 0, 0.00074, 0.002845, 0.017047, 0.018915, 0.017111, 0.002417, 0.002668)), .Names = c("long", "lat", "sp1", "sp2", "sp3", "sp4", "env1", "env2", "env3", "env4"), class = "data.frame", row.names = c(NA, -36L)) predi<-dd[,7:10] spA<-subset(dd,dd$sp1==1) m1 <- maxent(spA[,7:10], spA[,'sp1']) # for species 1 m1.prediction<-predict(m1, predi) spB<-subset(dd,dd$sp2==1) m2 <- maxent(spB[,7:10], spB[,'sp2']) # for species 2 m2.prediction<-predict(m2, predi) spC<-subset(dd,dd$sp3==1) m3 <- maxent(spC,7:10], spC[,'sp3']) # for species 3 m3.prediction<-predict(m3, predi) spD<-subset(dd,dd$sp4==1) m4 <- maxent(spD[,7:10], spD[,'sp4']) # for species 4 m4.prediction<-predict(m4, predi) prediction<-cbind(m1.prediction,m2.prediction,m3.prediction,m4.prediction) But, it did not work. I could not figure it out why it is not working. Another thing, How I can make a loop for several species? cheers, KG [[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.