Firstorder_var: Estimation of variance for first order parameters

Description Usage Arguments Value Author(s) References Examples

View source: R/stderror_beta.R

Description

This is a method to estimate the variance of the first order parameters

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Firstorder_var(
  X,
  covariate,
  Beta,
  r,
  bwd,
  kern = "Epanechnikov",
  cPCF = NULL,
  method = "single",
  cut = 1
)

Arguments

X

A multivariate point process. X must be of class ppp.

covariate

Covariates. The covariates must be a matrix. The rows corresponds to the points in the point pattern and the columns indicates the corresponding covariates that are observed at the location of the point pattern.

Beta

Estimated first order parameters. Beta must be a matrix. The number of rows must correspond to the number of covariates. The number of columns must correspond to the number of point types.

r

A vector of distances

bwd

The bandwidth used

kern

The kernel function. Default is Epanechnikov. Alternatively, the kernel function can be Indicator.

cPCF

Non parametric estimates of cross PCF ratios. Default is cPCF = NULL. If cPCF = NULL, then the cross PCF ratios are estimated using the function CrossPCF

method

Method to estimate the variance of the first order estimating function. Default method = "single", alternatively method = "pool". If method = "single", the variance is estimated based on single estimates of cross PCF ratios. If method = "pool", the variance is estimated based on an estimate of the pooled cross PCF.

cut

For refined cross PCF ratio estimator. Default cut = NULL. If cut = NULL, the parameter R^* for the constraint is chosen manually using the function ChooseRange

Value

Return estimated cross PCF ratios, r distances used, bandwidth used, refined cross PCF ratios and R^*

Author(s)

Kristian Bjørn Hessellund, Ganggang Xu, Yongtao Guan and Rasmus Waagepetersen.

References

Hessellund, K. B., Xu, G., Guan, Y. and Waagepetersen, R. (2020) Second order semi-parametric inference for multivariate log Gaussian Cox processes.

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
### First order analysis of Washington D.C. street crimes ###

nspecies <- length(unique(markedprocess$marks))
ncovs <- dim(Z_process)[2]

# Initial parameters for street crime data
Beta0=matrix(runif(nspecies*ncovs,-0.5,0.5),nrow =nspecies)

# Choosing the last type of street crime as the baseline
Beta0 <- as.matrix(t(scale(Beta0,center=Beta0[nspecies,],scale=FALSE)))

# Parameter estimation
Betahat=FirstOrderCCL(X=markedprocess,Beta0 = Beta0,covariate = Z_process)

# Parameter estimates
colnames(Betahat$betahat)=c("Burglary", "Assault w. weapon", "Motor v. theft",
"Theft f. auto", "Robbery", "Other theft (baseline)")
rownames(Betahat$betahat)=c("Intercept", "%African", "%Hispanic", "%Males",
 "Median income", "%Household","%Bachelor", "Distance to police station")
Betahat

### Non-parametric estimates of cross PCF ratios ###

rseq = seq(0,3000,length=100)
cpcf=CrossPCF(X = markedprocess,covariate = Z_process,Beta = Betahat$betahat,r = rseq
,bwd = 200,cut = NULL)

plot(rseq,rep(1,100),type="l",col=1,ylim=c(0,2),xlab="r",ylab="",main="PCFs")
for(i in 1:(nspecies-1)){
  lines(rseq,cpcf$cPCF.m[i,i,],,col=i)
}

plot(rseq,rep(1,100),type="l",col=1,ylim=c(0,2),xlab="r",ylab="",main="PCFs")
for(i in 1:(nspecies-1)){
  for(j in 1:(nspecies-1)){
    if(i==j){next}
    lines(rseq,cpcf$cPCF.m[i,j,],,col=1)
  }
}

### Standard errors for Beta ###

var.est=Firstorder_var(X=markedprocess,covariate = Z_process,Beta=Betahat$betahat,
r = seq(0,3000,length=100),bwd = 200,cPCF = cpcf$cPCF.m,method = "pool")

std.error=matrix(sqrt(diag(var.est$COV)),nrow=ncovs)
colnames(std.error)=c("Burglary", "Assault w. weapon", "Motor v. theft","Theft f. auto", "Robbery")
rownames(std.error)=c("Intercept", "%African", "%Hispanic", "%Males",
 "Median income", "%Household","%Bachelor", "Distance to police station")
std.error

kristianhessellund/Multilogreg documentation built on Jan. 1, 2021, 7:23 a.m.