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/utm_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@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo