[R-sig-Geo] Importing raster data from Arcview to R for fitting a ppm

Marcelino de la Cruz marcelino.delacruz at upm.es
Wed Apr 16 15:33:11 CEST 2008


May be I answered too fast....

Try better this:

xxx04.Q <- ppm(xxx04)$Q   # get default quadrature scheme

io <- !is.na(slope.subset[xxx04.Q, drop=F])  # select non-problematic points

xxx04.Qgood <- (xxx04.Q[io])       #  exclude problematic point

  class(xxx04.Qgood) <- "quad"

ppm(xxx04.Qgood, ~ x + y + slope, Poisson(), covariates = 
list(slope=slope.subset))





This should work indeed!



Marcelino









At 11:36 16/04/2008, Marcelino de la Cruz wrote:

>Hi,
>
>I don't remeber if this is corrected in the current version of
>spatstat (please, actualize) but, anyway, I think you can troubleshot
>the problem with this:
>
>
>io <- !is.na(slope.subset[xxx04, drop=F])
>
>ppm(xxx04[io], ~ x + y + slope, Poison(), covariates = 
>list(slope=slope.subset)
>
>
>
>I hope this helps,
>
>Marcelino
>
>
>
>At 20:49 15/04/2008, Honey Giroday wrote:
>
>
> >Hi All!
> >
> >I am a relatively new UseR and am currently using R 2.5.1 on a linux
> >operating system (I am connected to the linux system via remote
> >desktop connection).  I am trying to import a raster dataset (in
> >ASCII format) to fit as a covariate in a ppm.  However, I keep
> >getting this error message every time I got to fit the model.
> >
> >"Warning message:
> >Values of covariate "slope" were NA or undefined at 1% (1 out of
> >80812) of the quadrature points.  Occurred while executing:
> >ppm(xxx04, ~ x + y + slope, Poison(), covariates = list(slope=slope.subset)"
> >
> >At first I thought the problem sprung from the alignment of my image
> >(slope) with the object window of my point process
> >(xxx04).  However, I have the datasets are
> >in the same projection (UTM zone 10), and I have set the owin for
> >the points and subset the slope covariate to the same extent.  I
> >have also viewed the slope and image datasets in a plot and they
> >appear to line up correctly (i.e. there are no points that are
> >outside the extent of the slope image).  Can anyone assist me with
> >understanding the cause of this error message and suggest a method
> >to rectify/troubleshoot this problem?  Please see the code below to
> >see the steps I went through to fit the ppm.  Your help would be
> >much appreciated and thank you for your time in considering this issue.
> >
> >
> >
> >
> >
> >Sincerely,
> >
> >
> >
> >
> >
> >Honey-Marie Giroday, M.Sc. Candidate, A.Ag., B.I.T.
> >
> >University of Northern British Columbia
> >
> >
> >
> >
> >
> >#Read in shapefile data (2004, 2005, and 2006)
> >mpb04 <-
> >readShapePoints("N:/data/original/mpb/licensees/final/2004mpb_licensees")
> >
> >#Extract X and Y coordinates from ShapePoints
> >X <- mpb04$Easting
> >Y <- mpb04$Northing
> >
> >#Read in site characteristic covariates (ASCII)
> >slope <-
> >readAsciiGrid("N:/data/original/base_data/dem/bc/utm_tpi/slope20utm.txt",
> >as.image=TRUE)
> >
> >#Read in susceptibility covariates (ASCII)
> >sus0 <-
> >readAsciiGrid("N:/data/original/susceptibilitydata/climate_factor/u 
> tm_tpi/sus0.txt",
> >as.image=TRUE)
> >
> >#Convert covariates from list class to image class
> >image.slope <- as.im(slope)
> >sus0 <- as.im(sus0)
> >
> >#Create object window for analysis from one of the susceptibility datasets
> >sus0.win <- as.owin(sus0)
> >
> >#Subset site characteristic and landform datasets susceptibility boundary
> >slope.subset <- image.slope[sus0.win, drop=FALSE]
> >
> >#Use cut command to make landform and susceptibility a factor!
> >sus0.cut <- cut(sus0, 2)
> >
> >#Convert ShapePoints to point pattern manually
> >xxx04 <- ppp(x=mpb04$Easting, y=mpb04$Northing, window=sus0.win)
> >
> >#Test if model fitting works
> >fm1 <- ppm(xxx04, ~ x + y + slope, Poisson(), covariates=list(slope=slope))
> >
> >
> >_________________________________________________________________
> >Turn every day into $1000. Learn more at SignInAndWIN.ca
> >http://g.msn.ca/ca55/213
> >         [[alternative HTML version deleted]]
> >
> >_______________________________________________
> >R-sig-Geo mailing list
> >R-sig-Geo at stat.math.ethz.ch
> >https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>***************************************
>Marcelino de la Cruz Rot
>Depto. Biologia Vegetal
>EUIT Agricola
>Universidad Politecnica de Madrid
>28040-Madrid
>SPAIN
>***************************************
>         [[alternative HTML version deleted]]
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at stat.math.ethz.ch
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo


***************************************
Marcelino de la Cruz Rot
Depto. Biologia Vegetal
EUIT Agricola
Universidad Politecnica de Madrid
28040-Madrid
SPAIN




More information about the R-sig-Geo mailing list