| gof.sandwich {EDFtest} | R Documentation |
GOF tests for general distributions using Sandwich estimation of covariance function
Description
This function tests the hypothesis that data y come from
distribution Fdist with unknown parameter values theta.
Estimates of theta must be provided in thetahat.
Usage
gof.sandwich(y, x = NULL, Fdist, thetahat, Score, m = max(n, 100), ...)
Arguments
y |
A random sample or the response of regression problem. |
x |
The matrix of covariates. |
Fdist |
User supplied function to compute probability integral transform of y. |
thetahat |
Parameter estimates by MLE. |
Score |
User supplied function to compute 3 components of the score function
an n by p matrix with entries partial log f(y_i, |
m |
Eigenvalues are extracted for an m by m grid of the covariance function. |
... |
Other inputs passed to |
Details
It uses a large sample approximation to the limit distribution based on the use of the score function components to estimate the Fisher information and the limiting covariance function of the empirical process.
The estimates thetahat should be roots of the likelihood equations.
Value
Cramér-von Mises, Anderson-Darling and Watson statistics and their P-values.
See Also
gof for generic functions using imhof function;
gof.bootstrap for generic functions using bootstrap method.
Examples
sample = rnorm(n=100,mean=0,sd=1)
mle = estimate.normal(sample)
cdf.normal.user = function(x,theta){
pnorm(x,mean=theta[1],sd=theta[2])
}
score.normal.user = function(x,theta){
sig=theta[2]
mu=theta[1]
s.mean= (x-mu)/sig
s.sd= s.mean^2/sig-length(x)/sig
cbind(s.mean/sig,s.sd)
}
output = gof.sandwich(y=sample,Fdist=cdf.normal.user,thetahat=mle,Score=score.normal.user,m=100)
output