plot.plbpsm: Default PLBPSM plotting

Description Usage Arguments Details Examples

View source: R/plot_plbpsm.R

Description

Takes a fitted plbpsm object produced by plbpsm() and plots the triangulation of location data points, predicted surface of bivariate smooth function and optionally produces histogram of residuals for the model.

Usage

1
2
3
4
## S3 method for class 'plbpsm'
plot(x, residuals = FALSE, pages = 0, select = NULL,
  xlab = NULL, ylab = NULL, main = NULL, ylim = NULL,
  xlim = NULL, n1 = 40, n2 = 40, ...)

Arguments

x

a fitted plbpsm object as produced by plbpsm

residuals

If TRUE then a histogram of standardized residuals will be added.

pages

(default 0) the number of pages over which to spread the output. For example, if pages=1 then all terms will be plotted on one page with the layout performed automatically. Set to 0 to have the routine leave all graphics settings as they are.

select

Allows the plot for a single model term to be selected for printing. e.g. if you just want the plot for the second smooth term set select=2.

xlab

If supplied then this will be used as the x label for all plots.

ylab

If supplied then this will be used as the y label for all plots.

main

Used as title for plots if supplied.

ylim

If supplied then this pair of numbers are used as the y limits for each plot.

xlim

If supplied then this pair of numbers are used as the x limits for each plot.

n1

number of points used in x axis in each plot.

n2

number of points used in y axis in each plot.

...

other graphics parameters to pass on to plotting commands. See details for smooth plot specific options.

Details

Used R package fdaPDE and plotly to draw triangulation plot and predicted surfaces. See plbpsm:::plot.plbpsm.smooth.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
library(MASS)
library(grpreg)

# irregular domain:
library(GgAM)
library(BPST)
data("eg1pop_dat")
eg1_V2=eg1pop_dat[['V2']]
eg1_T2=eg1pop_dat[['T2']]
eg1pop_rho03=eg1pop_dat[['rho03']]
n=1000
Npop=nrow(eg1pop_rho03)
# ind.pop=(1:Npop)[!is.na(eg1pop_rho03[,1])]
ind.pop=(1:Npop)
sam.ind=sort(sample(ind.pop,n,replace=FALSE))
sam=eg1pop_rho03[sam.ind,]
lambda=10^(seq(-2,5,by=1))
data=sam
formula=Y~z1+z2+z3+z4+z5+z6+z7+z8+b(x1,x2,V=eg1_V2,Tr=eg1_T2,d=2,r=1,lambda=lambda)
res=plbpsm(formula=formula,data=as.data.frame(data))
plot(res,residuals=TRUE,n1=80,n2=50)

### GGAM ###
data(dat_poi_ggams)
n=100
Npop=nrow(dat_poi_ggams)
# ind.pop=(1:Npop)[!is.na(eg1pop_poi2[,1])]
ind.pop=(1:Npop)
sam.ind=sort(sample(ind.pop,n,replace=FALSE))
sam=dat_poi_ggams[sam.ind,]
data=sam
formula=y~u(x1)+u(x2)+u(x3)+b(s1,s2,V=eg1_V2,Tr=eg1_T2,d=2,r=1)
res_eg1_poi_add=plbpsm(formula=formula,data=as.data.frame(data),family='poisson')
summary(res_eg1_poi_add)
plot(res_eg1_poi_add)

funstatpackages/GgAM documentation built on Nov. 4, 2019, 12:59 p.m.