Re: [R-sig-Geo] stars st_transform gives NA to the offset and delta parameters

2021-06-07 Thread Manuel Spínola
Thank you very much Edzer,

I am working with a raster file of land cover from the Copernicus Global
Land Service that is 100m resolution but the file is in a regular
latitude/longitude grid (EPSG:4326).

How can I project this file to UTM keeping the 100m resolution?

You told me to go with st_warp but when I did that I got the following
error.

raster_utm <- st_warp(land_cover, crs = 5367)

Error in matrix(seq_len(prod(dims[dxy])), dims[dxy[1]], dims[dxy[2]])[xy] :
subscript out of bounds


I am missing an argument?

How can I specify the target grid template?

Manuel

El lun, 7 jun 2021 a las 1:02, Edzer Pebesma ()
escribió:

>
>
> On 07/06/2021 01:16, Manuel Spínola wrote:
> > Dear list members,
> >
> > When using st_transform in a stars object the offset and delta parameters
> > become NA, is this an expected behavior?
>
> Yes, it also says that you got a curvilinear grid as a result, which is
> a grid with non-constant cell size (delta) and non-constant coordinate
> of the side (offset); see
> https://keen-swartz-3146c4.netlify.app/intro.html#raster-types
>
> If you want a regular grid in the new CRS, use st_warp(), preferably
> with the target grid template.
>
> >
> >
> > geomatrix = system.file("tif/geomatrix.tif", package = "stars")
> > x = read_stars(geomatrix)
> >
> > new = st_crs(4326)
> > y = st_transform(x, new)
> > y
> >
> >
> >
> >
> > *Manuel Spínola, Ph.D.*
> > Instituto Internacional en Conservación y Manejo de Vida Silvestre
> > Universidad Nacional
> > Apartado 1350-3000
> > Heredia
> > COSTA RICA
> > mspin...@una.cr 
> > mspinol...@gmail.com
> > Teléfono: (506) 8706 - 4662
> > Personal website: Lobito de río <
> https://sites.google.com/site/lobitoderio/>
> > Institutional website: ICOMVIS 
> >
> >   [[alternative HTML version deleted]]
> >
> > ___
> > R-sig-Geo mailing list
> > R-sig-Geo@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> --
> Edzer Pebesma
> Institute for Geoinformatics
> Heisenbergstrasse 2, 48151 Muenster, Germany
> Phone: +49 251 8333081
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>


-- 
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspin...@una.cr 
mspinol...@gmail.com
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río 
Institutional website: ICOMVIS 

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] How to obtain standard errors of local regression coefficients in spgwr::ggwr()?

2021-06-07 Thread Manuel Luis Castro Ribeiro via R-sig-Geo

Ok, thank you for your suggestion and clarification.
Manuel


A 2021-06-06 15:14, Roger Bivand escreveu:

Does ?spgwr::ggwr state that any such values are returned? It says:

"a SpatialPointsDataFrame (may be gridded) or SpatialPolygonsDataFrame
object (see package "sp") with fit.points, weights, GWR coefficient
estimates, dispersion if a "quasi"-family is used, and the residuals
of type "type" in its "data" slot."

Nothing else is returned. You may like to try the GWmodel package,
which may offer some further output, but this is a largely unexplored
area, and in any case inference is not encouraged for GW output as the
technique is exploratory.

Hope this clarifies.

Roger

PS. Please post plain text, not HTML-formatted.

On Sun, 6 Jun 2021, mr via R-sig-Geo wrote:


Dear list,

I am using spgwr::ggwr() to fit generalized geographically weighted 
regression with Poisson model and log-link function. The results 
provide local coefficient estimates, but i am missing how to get their 
standard errors (or t statistics) to compute pseudo p-values.

Below is a toy example using SpatialEpi::NYleukemia dataset:

# 

library(SpatialEpi)
library(spgwr)

## Load data
data(NYleukemia)
population <- NYleukemia$data$population
cases <- ceiling(NYleukemia$data$cases * 100)
centroids <- latlong2grid(NYleukemia$geo[, 2:3])

# data frame
nyleuk <- data.frame(centroids, cases, population)

# set coordinates as vector
coordny <- cbind(centroids[,1],centroids[,2])

# set a kernel bandwidth
bw <- 0.5

# fit ggwr()
m_pois <- ggwr(cases ~ offset(log(population)),
  data = nyleuk, gweight = gwr.Gauss,
  adapt = bw, family = poisson(link="log"),
  type="working", coords = coordny)

# returns spatial point with coefficients
# but no standard errors :(
head(m_pois$SDF@data)

# ---

Is there any way to get standard errors of the local coefficients?
Thank you, Manuel


Sent from Mail for Windows 10


[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] stars st_transform gives NA to the offset and delta parameters

2021-06-07 Thread Edzer Pebesma




On 07/06/2021 01:16, Manuel Spínola wrote:

Dear list members,

When using st_transform in a stars object the offset and delta parameters
become NA, is this an expected behavior?


Yes, it also says that you got a curvilinear grid as a result, which is 
a grid with non-constant cell size (delta) and non-constant coordinate 
of the side (offset); see 
https://keen-swartz-3146c4.netlify.app/intro.html#raster-types


If you want a regular grid in the new CRS, use st_warp(), preferably 
with the target grid template.





geomatrix = system.file("tif/geomatrix.tif", package = "stars")
x = read_stars(geomatrix)

new = st_crs(4326)
y = st_transform(x, new)
y




*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspin...@una.cr 
mspinol...@gmail.com
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río 
Institutional website: ICOMVIS 

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo