Francesco Tonini | 31 Jul 17:45 2014
Picon

Error gstat function krigeST

Dear all,

I am working with an hourly dataset of air temperature, recorded at ~200 
stations over a relatively small area. I chose a space-time variogram 
(e.g. sum-metric) to fit my data and am now trying to make predictions 
over my same stations in order to fill NA (missing value) gaps. When 
using the krigeST() function over daily aggregated data everything seems 
to go smooth but when I use it at the original hourly resolution I 
always get the following error:

Error in chol.default(A)
the leading minor of order 68 is not positive definite

I googled it and found that it is related to a matrix not being 
completely positive-definite. However, I am not sure why this happens 
and was wondering if any of you know a way of fixing this (a workaround 
to avoid it).

Thanks!
Francesco
Diederik Strubbe | 31 Jul 17:11 2014
Picon

biomod2 - weighting or subsetting occurrence data?

Dear biomodders,

I am faced with a question on selecting species occurrences as input
data for a biomod run. Specifically, I have a number of beaver (/Castor
fiber/) observations which I want to use to model future beaver range
expansion. The data amount to about 1.800 occurrences, representing 72
territories. The number of occurrences per territory varies between 1
and 65 (mean: 25). There are two obvious choices I can make: 1) use all
1800 data, increasing sample sizes -- but running the risk that the
results will (too?) strongly be influenced by the territories with a
large number of occurrences. 2) only use 1 occurrence per territory,
allowing an 'equal weight' for each territory -- but reducing sample
size (i.e. reducing how good territories are 'sampled').

An alternative would be to do multiple model runs whereby I randomly
select 25 occurrences (the mean number) from the territories with > 25
observations while using all available occurrences for the other
territories. Another way would be to weight or scale the occurrence data
-- for example downweighting the influence of occurrences belonging to a
territorial with a large number of occurrences.

While I can implement standalone R scripts to sub select/downweight
data, I am not sure how to feed this into the biomod flow. Any
suggestions on how to tackle this are much appreciated!

Best wishes and thanks in advance,

Diederik

--

-- 
(Continue reading)

HallS | 31 Jul 14:32 2014
Picon

Merging shapefiles and csv

Hi all,

I'm struggling to know how this will come across as my data is confidential.

Basically I have a shapefile (.shp) and a csv file while contain the same
regions (i.e.) a column which has the same information.  Using this link:
https://sites.google.com/site/eospansite/alobotips/spatial_r_tips/rshp_xls
I managed to get quite far but once I got to the writeOGR command, I get the
error
 Error in writeOGR(RSANHS, dsn = "C:/Users/Laptop/Documents/Rworkspace/",  : 
  number of objects mismatch

shape1 <at> data <- merge(shape1 <at> data,csv,by.x="RSA", 
+                           by.y="RSA", all.x=T, sort=F)
> 
> ###Checking it
> dim(shape <at> data)
[1] 1745    2
> dim(shape1 <at> data)
[1] 1747    5

This shows a discrepancy in two rows between the original shapefile and the
new merged one.  When I looked at the merged file in full, there were a
number of NA rows at the bottom where there was no corresponding data to the
shapefile.  I tried shape1 <at> data <- na.exclude(shape1 <at> data) and with na.omit,
and this did reduce the number of rows to 1690, but the problem persists.

Sorry if this is a really unhelpful question, I'm not sure how to do it when
data is confidential.

(Continue reading)

Dave Leighton | 30 Jul 21:18 2014

Copulas and spatial modeling

We are interested in using copulas for spatial modeling of environmental
data. We are new to R and new to copulas. We’re looking for some guidance
on how to use copulas for this application. I've searched the r-help
archives and I have not found the information I need to get started. Can
anyone point me to information or examples of how to apply copulas to
spatial modeling of environmental data using R?

Thanks.

*Dave Leighton*

*HydroFocus, Inc. 530-759-2484*

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo <at> r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Herry | 30 Jul 05:39 2014
Picon
Picon

plotting raster returns error about NA

Hi List,

surely others have come across this and the solution is probably simple - I
cannot find it online anywhere. I am trying to plot a gtiff raster (produced
in grass 6.4.2, lzw compression)

image(rs) works fine but when trying to use plot I get the following error
message:
Error in .readCellsGDAL(x, uniquecells, layers) : 
  NAs are not allowed in subscripted assignments
In addition: Warning message:
In .readCells(x, cells, 1) : NAs introduced by coercion

What am I doing wrong?

thanks and cheers
Herry

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/plotting-raster-returns-error-about-NA-tp7586834.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
Hodgess, Erin | 29 Jul 18:56 2014

question about autoKrige anis1 and anis2

Hello again!

I was using autoKrige (finally successfully!) and was looking at the model results.  I got anis1 of 1,1 and
anis2 of 1,1.

How does this relate to the anis in the vgm function, please?

Thanks,

Erin

	[[alternative HTML version deleted]]
adamsmith | 29 Jul 18:09 2014
Picon

Classical or robust variogram to model temporal autocorrelation?

Hello list,

I'm modeling counts of organisms over time at eleven locations.  I'd like to
account for temporal autocorrelation in the counts (assuming it's present),
which I'm exploring (and fitting) using gstat's variogram function on the
residuals of a generalized linear model not incorporating any kind of
correlation structure.  

As the example below illustrates, I'm finding that the classical variogram
estimator looks quite different from the robust (Cressie) estimator. 
Furthermore, a fit of most variogram models to the classic variogram
produces singularity errors (with good reason based on the variogram plot)
while a decent exponential model (e.g.) can be fitted to the robust
variogram.  Unfortunately, it seems as though nlme:::lme (which I'm using
for the generalized model) only uses the classical variogram when fitting
correlation structures.

Thus, my questions:

(1) Is the use of the robust estimator for constructing the correlation
structure justified in this case?  
(2) If so, is it appropriate to fit the the robust variogram model in, e.g.,
gstat, and then specify/fix the correlation structure in the lme fit?

Thanks very much for considering,

Adam Smith
Dept. Natural Resources Science
University of Rhode Island

(Continue reading)

Maurizio Marchi | 29 Jul 17:48 2014
Picon

GAM: which package?

Hi everybody,
I would like to try to work with generalized Additive Models to interpolate
some climatic data and to build a Species Distribution Model. The aim is to
check performances comparing them with works made by my colleague.
I was wondering:
Which R package is the most complete?

here (http://cran.r-project.org/web/packages/dismo/vignettes/sdm.pdf)
"mgcv" is suggested even if "gam" package seems the "pure" GAM.

many thanks,

--

-- 
Maurizio Marchi, Ph.D. student
Florence, Italy
ID skype: maurizioxyz
Ubuntu 14.04 LTS
linux user 552742

	[[alternative HTML version deleted]]
Mark Payne | 29 Jul 11:43 2014
Picon

raster - 4D Bricks

Hi,

I have a 4D climate model output that I am trying to work with via raster,
and that is unfortunately giving problems. I create the object as a brick:

> b
class       : RasterBrick
dimensions  : 220, 254, 55880, 756  (nrow, ncol, ncell, nlayers)
resolution  : 1, 1  (x, y)
extent      : 0.5, 254.5, 0.5, 220.5  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84
data source : /home/mpayne/Documents/NACLIM/
ncep_07c_tho_all_1948-2010.mon.nc
names       : X19480131, X19480229, X19480331, X19480430, X19480531,
X19480630, X19480731, X19480831, X19480930, X19481031, X19481130,
X19481231, X19490131, X19490228, X19490331, ...
z-value     : 19480131, 20101231 (min, max)
varname     : var2
level       : 3

But I would like to drop a lot of the layers, so I try:

> dropLayer(b,1:5)
Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘extent’ for signature
‘"character"’
>

And get a rather strange error.... Trying subset instead:

(Continue reading)

A. Robles R. | 29 Jul 08:21 2014
Picon

Help me please

I have the following problem:
I am using the reprojectHDF() function (http://r-gis.net/?q=ModisDownload
<http://l.facebook.com/l.php?u=http%3A%2F%2Fr-gis.net%2F%3Fq%3DModisDownload&h=1AQFfebGn&enc=AZM5YrD9AkE2y7Rnk6mbbkY0ZyXJ74Tw0ErhgFhwX0uZ9ComxS8l0Ap5a9oxWLUibJyzZ40-fdx0TejlaLCeB4gT47JF_ly2QHY7Z4SEuRHrCWaGxIiU9PL9jUOLCbQYnPYuwNCiVop4xVvlVN0HNeZj&s=1>
)
####
source('ModisDownload.R')
library(raster)
library(RCurl)
path<-"~/R/MODIS/Data/Test"
input<-list.files(path,"*.hdf",all.files=T,recursive=T,full.names=T)
input
outname<-paste(substr(input[1],40,45),".tif",sep='')
outname
reprojectHDF(hdfName=input,filename=outname,MRTpath="~/MRT/bin",
resample_type="NEAREST_NEIGHBOR",
proj_type="GEO",datum='WGS84')
####
but I find the following problem.
####
> reprojectHDF(hdfName=input,filename=outname,MRTpath="~/MRT/bin",
+ resample_type="NEAREST_NEIGHBOR",
+ proj_type="GEO",datum='WGS84')
******************************************************************************
MODIS Reprojection Tool (v4.1 March 2009)
Start Time: Tue Jul 29 00:57:18 2014
------------------------------------------------------------------
Error: ReadHDFHeader : Opening Input Header File
: Unable to open
/home/rral/R/MODIS/Data/Test//home/rral/R/MODIS/Data/Test/MOD13Q1.A2000065.h09v08.005.2008238073751.hdf
Fatal Error, Terminating...
(Continue reading)

Hodgess, Erin | 28 Jul 22:22 2014

how to change the fit.method from autoKrige, please

Hello!

I'm using the autoKrige function on a data set and keep getting an error that fit.method 7 has zero semivariances.

How do I change the fit.method from within autoKrige, please?

I've tried using it both inside and outside of miscFitOptions, but no luck yet.

Any suggestions would be much appreciated.

Sincerely,

Erin

	[[alternative HTML version deleted]]

Gmane