ich möchte die Vorhersage der Abundanz einer Art in einer Karte plotten. Ich habe die gbm. step Funktion benutzt.
Code: Alles auswählen
modell_N_M_raster_2 <- gbm.step(
data= data_wG,
gbm.x = 2:6 ,
gbm.y = 1,
family = "poisson",
tree.complexity = 3,
max.trees = 1000,
learning.rate = 0.001,
bag.fraction = 0.5,
n.folds = 5,
plot.main=T)
Code: Alles auswählen
> str(data_wG)
'data.frame': 90 obs. of 7 variables:
$ ges.abundanz: int 2304 2047 1568 1120 1952 1280 1856 1247 1696 1248 ...
$ Slope : num 1.4 1.3 1.5 1.7 2 3.7 3.6 0.3 0.3 3.4 ...
$ Landuse : Factor w/ 2 levels "arable land",..: 1 1 1 1 1 2 2 2 2 2 ...
$ TWI : num 7.4 6.4 6.4 6.1 7 6.2 6.7 7.4 7.4 6 ...
$ HLI : num 0.7 0.8 0.73 0.94 0.03 0.11 0.36 0.33 0.19 0.31 ...
$ Geology : Factor w/ 4 levels "SA","SC","AV",..: 1 2 3 4 4 4 4 4 4 4 ...
$ Site_ID : chr "Nov_1_1" "Nov_1_2" "Nov_1_3" "Nov_1_4" ...
Code: Alles auswählen
pred.abundance_HW_3 <- predict(caos_brick_2, modell_N_M_raster_2 ,n.trees=1000,
na.rm =T, type = "response", )
Code: Alles auswählen
caos_brick_2<-brick(landuse, slope, twi,hli, geologie)
Code: Alles auswählen
> str(geologie)
Formal class 'RasterLayer' [package "raster"] with 12 slots
..@ file :Formal class '.RasterFile' [package "raster"] with 13 slots
.. .. ..@ name : chr "/Users/MAXVN/Desktop/Bachelorarbeit2/geologie.asc"
.. .. ..@ datanotation: chr "FLT4S"
.. .. ..@ byteorder : chr "little"
.. .. ..@ nodatavalue : num -9999
.. .. ..@ NAchanged : logi FALSE
.. .. ..@ nbands : int 1
.. .. ..@ bandorder : chr "BIL"
.. .. ..@ offset : int 6
.. .. ..@ toptobottom : logi TRUE
.. .. ..@ blockrows : int 0
.. .. ..@ blockcols : int 0
.. .. ..@ driver : chr "ascii"
.. .. ..@ open : logi FALSE
..@ data :Formal class '.SingleLayerData' [package "raster"] with 13 slots
.. .. ..@ values : logi(0)
.. .. ..@ offset : num 0
.. .. ..@ gain : num 1
.. .. ..@ inmemory : logi FALSE
.. .. ..@ fromdisk : logi TRUE
.. .. ..@ isfactor : logi FALSE
.. .. ..@ attributes: list()
.. .. ..@ haveminmax: logi FALSE
.. .. ..@ min : num Inf
.. .. ..@ max : num -Inf
.. .. ..@ band : int 1
.. .. ..@ unit : chr ""
.. .. ..@ names : chr ""
..@ legend :Formal class '.RasterLegend' [package "raster"] with 5 slots
.. .. ..@ type : chr(0)
.. .. ..@ values : logi(0)
.. .. ..@ color : logi(0)
.. .. ..@ names : logi(0)
.. .. ..@ colortable: logi(0)
..@ title : chr(0)
..@ extent :Formal class 'Extent' [package "raster"] with 4 slots
.. .. ..@ xmin: num 45806
.. .. ..@ xmax: num 71906
.. .. ..@ ymin: num 85296
.. .. ..@ ymax: num 101996
..@ rotated : logi FALSE
..@ rotation:Formal class '.Rotation' [package "raster"] with 2 slots
.. .. ..@ geotrans: num(0)
.. .. ..@ transfun:function ()
..@ ncols : int 522
..@ nrows : int 334
..@ crs :Formal class 'CRS' [package "sp"] with 1 slot
.. .. ..@ projargs: chr NA
..@ history : list()
..@ z : list()
Ich habe es so probiert aber leider keinen Erfolg gehabt:
Code: Alles auswählen
pred.abundance_HW_3 <- predict(caos_brick_2, modell_N_M_raster_2 ,n.trees=1000,
na.rm =T, type = "response", geologie==1, landuse==1,2)
Ich hoffe es ist deutlich geworden was meine Frage ist. Ich danke im Voraus für Tipps.