A surface of GWR predicted values

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

A surface of GWR predicted values

fred_r_ramos
Dear all,

I`m trying to build a surface with predicted values using gwr.predict.

When I run the gwr.predict without giving the fitting point it runs without problems. But when I enter with SpatialPointsDataFrame (a point grid) as fitting points the prediction values returns NA. Is there anything that I could do to get these results in the fitting points?


> gwr_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,kernel="gaussian",bw=21720)

> gwr_test$SDF
class       : SpatialPointsDataFrame
features    : 423
extent      : 292782, 414055.3, 7349266, 7424404  (xmin, xmax, ymin, ymax)
crs         : +proj=utm +zone=23 +south +ellps=intl +units=m +no_defs
variables   : 5
names       :     Intercept_coef,        distances_coef, pop_density_log_coef,        prediction,    prediction_var
min values  : -0.958964210431336, -0.000128871984509238,    0.287006700717343, -3.26862056578432,  0.48618073025782
max values  :   4.17712723602899,  -1.8499577687439e-06,    0.979959974621219,  5.64311734285255, 0.693583031013022

> gwr_out_grid_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,predictdata=grade_g_DF,kernel="gaussian",bw=21720)


> gwr_out_grid_test$SDF
class       : SpatialPointsDataFrame
features    : 9075
extent      : 293282, 413282, 7349904, 7423904  (xmin, xmax, ymin, ymax)
crs         : +proj=utm +zone=23 +south +ellps=intl +units=m +no_defs
variables   : 5
names       :    Intercept_coef,        distances_coef, pop_density_log_coef, prediction, prediction_var
min values  : -1.18701861474003, -0.000127242449368378,    0.310710138723114,         NA,             NA
max values  :  4.04479455484814,  2.02812418949068e-06,    0.995539141570355,         NA,             NA

Many thanks,
Fred.




Sent from Mail for Windows 10


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: A surface of GWR predicted values

Roger Bivand
Administrator
Please do not post HTML, only plain text.

You do need to say which package gwr.predict() comes from. Better, provide
a reproducible example with a built-in data set showing your problem.

Roger

On Tue, 12 Nov 2019, Fred Ramos wrote:

> Dear all,
>
> I`m trying to build a surface with predicted values using gwr.predict.
>
> When I run the gwr.predict without giving the fitting point it runs without problems. But when I enter with SpatialPointsDataFrame (a point grid) as fitting points the prediction values returns NA. Is there anything that I could do to get these results in the fitting points?
>
>
>> gwr_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,kernel="gaussian",bw=21720)
>
>> gwr_test$SDF
> class       : SpatialPointsDataFrame
> features    : 423
> extent      : 292782, 414055.3, 7349266, 7424404  (xmin, xmax, ymin, ymax)
> crs         : +proj=utm +zone=23 +south +ellps=intl +units=m +no_defs
> variables   : 5
> names       :     Intercept_coef,        distances_coef, pop_density_log_coef,        prediction,    prediction_var
> min values  : -0.958964210431336, -0.000128871984509238,    0.287006700717343, -3.26862056578432,  0.48618073025782
> max values  :   4.17712723602899,  -1.8499577687439e-06,    0.979959974621219,  5.64311734285255, 0.693583031013022
>
>> gwr_out_grid_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,predictdata=grade_g_DF,kernel="gaussian",bw=21720)
>
>
>> gwr_out_grid_test$SDF
> class       : SpatialPointsDataFrame
> features    : 9075
> extent      : 293282, 413282, 7349904, 7423904  (xmin, xmax, ymin, ymax)
> crs         : +proj=utm +zone=23 +south +ellps=intl +units=m +no_defs
> variables   : 5
> names       :    Intercept_coef,        distances_coef, pop_density_log_coef, prediction, prediction_var
> min values  : -1.18701861474003, -0.000127242449368378,    0.310710138723114,         NA,             NA
> max values  :  4.04479455484814,  2.02812418949068e-06,    0.995539141570355,         NA,             NA
>
> Many thanks,
> Fred.
>
>
>
>
> Sent from Mail for Windows 10
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: A surface of GWR predicted values

binbinlu@whu.edu.cn
Dear Fred,

It seems that you were using the gwr.predict from the GWmodel package.




Note that the condition of outputing predictions at specific locations is that observations of the corresponding exploratory variables are available.

The predictions are output when you use the following routine:

gwr_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,kernel="gaussian",bw=21720)

because you were predicting the observations.

When you specified a point grid, NA were returned. I assumed that you didn't have any observed exploratory variables at them, and that's why. Note that GWR is not an interpolation technique.




Hope it helps.

Cheers,

Binbin








> -----原始邮件-----
> 发件人: "Roger Bivand" <[hidden email]>
> 发送时间: 2019-11-12 20:59:17 (星期二)
> 收件人: "Fred Ramos" <[hidden email]>
> 抄送: "[hidden email]" <[hidden email]>
> 主题: Re: [R-sig-Geo] A surface of GWR predicted values
>
> Please do not post HTML, only plain text.
>
> You do need to say which package gwr.predict() comes from. Better, provide
> a reproducible example with a built-in data set showing your problem.
>
> Roger
>
> On Tue, 12 Nov 2019, Fred Ramos wrote:
>
> > Dear all,
> >
> > I`m trying to build a surface with predicted values using gwr.predict.
> >
> > When I run the gwr.predict without giving the fitting point it runs without problems. But when I enter with SpatialPointsDataFrame (a point grid) as fitting points the prediction values returns NA. Is there anything that I could do to get these results in the fitting points?
> >
> >
> >> gwr_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,kernel="gaussian",bw=21720)
> >
> >> gwr_test$SDF
> > class       : SpatialPointsDataFrame
> > features    : 423
> > extent      : 292782, 414055.3, 7349266, 7424404  (xmin, xmax, ymin, ymax)
> > crs         : +proj=utm +zone=23 +south +ellps=intl +units=m +no_defs
> > variables   : 5
> > names       :     Intercept_coef,        distances_coef, pop_density_log_coef,        prediction,    prediction_var
> > min values  : -0.958964210431336, -0.000128871984509238,    0.287006700717343, -3.26862056578432,  0.48618073025782
> > max values  :   4.17712723602899,  -1.8499577687439e-06,    0.979959974621219,  5.64311734285255, 0.693583031013022
> >
> >> gwr_out_grid_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,predictdata=grade_g_DF,kernel="gaussian",bw=21720)
> >
> >
> >> gwr_out_grid_test$SDF
> > class       : SpatialPointsDataFrame
> > features    : 9075
> > extent      : 293282, 413282, 7349904, 7423904  (xmin, xmax, ymin, ymax)
> > crs         : +proj=utm +zone=23 +south +ellps=intl +units=m +no_defs
> > variables   : 5
> > names       :    Intercept_coef,        distances_coef, pop_density_log_coef, prediction, prediction_var
> > min values  : -1.18701861474003, -0.000127242449368378,    0.310710138723114,         NA,             NA
> > max values  :  4.04479455484814,  2.02812418949068e-06,    0.995539141570355,         NA,             NA
> >
> > Many thanks,
> > Fred.
> >
> >
> >
> >
> > Sent from Mail for Windows 10
> >
> >
> >  [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [hidden email]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; e-mail: [hidden email]
> https://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: A surface of GWR predicted values

fred_r_ramos
Dear Binbin,

Yes, it helped a lot. Thanks for the clarification.

Best,
Fred.

Sent from Mail for Windows 10

From: [hidden email]
Sent: Tuesday, November 12, 2019 4:19 PM
To: [hidden email]; fred ramos
Cc: [hidden email]
Subject: Re: Re: [R-sig-Geo] A surface of GWR predicted values

Dear Fred,
It seems that you were using the gwr.predict from the GWmodel package.

Note that the condition of outputing predictions at specific locations is that observations of the corresponding exploratory variables are available.
The predictions are output when you use the following routine:
gwr_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,kernel="gaussian",bw=21720)
because you were predicting the observations.
When you specified a point grid, NA were returned. I assumed that you didn't have any observed exploratory variables at them, and that's why. Note that GWR is not an interpolation technique. 

Hope it helps.
Cheers,
Binbin



> -----原始邮件-----
> 发件人: "Roger Bivand" <[hidden email]>
> 发送时间: 2019-11-12 20:59:17 (星期二)
> 收件人: "Fred Ramos" <[hidden email]>
> 抄送: "[hidden email]" <[hidden email]>
> 主题: Re: [R-sig-Geo] A surface of GWR predicted values

> Please do not post HTML, only plain text.

> You do need to say which package gwr.predict() comes from. Better, provide 
> a reproducible example with a built-in data set showing your problem.

> Roger

> On Tue, 12 Nov 2019, Fred Ramos wrote:

> > Dear all,
> >
> > I`m trying to build a surface with predicted values using gwr.predict.
> >
> > When I run the gwr.predict without giving the fitting point it runs without problems. But when I enter with SpatialPointsDataFrame (a point grid) as fitting points the prediction values returns NA. Is there anything that I could do to get these results in the fitting points?
> >
> >
> >> gwr_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,kernel="gaussian",bw=21720)
> >
> >> gwr_test$SDF
> > class       : SpatialPointsDataFrame
> > features    : 423
> > extent      : 292782, 414055.3, 7349266, 7424404  (xmin, xmax, ymin, ymax)
> > crs         : +proj=utm +zone=23 +south +ellps=intl +units=m +no_defs
> > variables   : 5
> > names       :     Intercept_coef,        distances_coef, pop_density_log_coef,        prediction,    prediction_var
> > min values  : -0.958964210431336, -0.000128871984509238,    0.287006700717343, -3.26862056578432,  0.48618073025782
> > max values  :   4.17712723602899,  -1.8499577687439e-06,    0.979959974621219,  5.64311734285255, 0.693583031013022
> >
> >> gwr_out_grid_test <- gwr.predict(job_density_log~distances+pop_density_log,data=zonas_OD_P_sp,predictdata=grade_g_DF,kernel="gaussian",bw=21720)
> >
> >
> >> gwr_out_grid_test$SDF
> > class       : SpatialPointsDataFrame
> > features    : 9075
> > extent      : 293282, 413282, 7349904, 7423904  (xmin, xmax, ymin, ymax)
> > crs         : +proj=utm +zone=23 +south +ellps=intl +units=m +no_defs
> > variables   : 5
> > names       :    Intercept_coef,        distances_coef, pop_density_log_coef, prediction, prediction_var
> > min values  : -1.18701861474003, -0.000127242449368378,    0.310710138723114,         NA,             NA
> > max values  :  4.04479455484814,  2.02812418949068e-06,    0.995539141570355,         NA,             NA
> >
> > Many thanks,
> > Fred.
> >
> >
> >
> >
> > Sent from Mail for Windows 10
> >
> >
> >  [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [hidden email]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >

> -- 
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

> _______________________________________________
> R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo