residuals.dfrr: Obtain residuals for a dfrr model

Description Usage Arguments See Also Examples

View source: R/residuals.dfrr.R

Description

Returns the residuals of a fitted dfrr model. A dfrr model is of the form:

Y_{i}(t)=I(W_{i}(t)>0),

in which I(.) is the indicator function and W_{i}(t)=Z_{i}(t)+ε_{i}(t)\timesσ^2, where Z_{i}(t) is the functional part of the model and epsilon_{i}(t)\timesσ^2 is the measurement error. The functional part of the model, consisting a location and a residual function of the form:

Z_{i}(t)=∑_{j=1}^{q}β_{j}(t)*x_{ji}+\varepsilon_{i}(t),

and ε_{i}(t) are iid standard normal for each i and t. The residuals reported in the output of this functions is the estimation of the measurement error of the model i.e. ε_{i}(t)\timesσ^2, which is estimated by:

E(W_{i}(t)-Z_{i}(t)\mid Y_{i}(t)).

Usage

1
2
## S3 method for class 'dfrr'
residuals(object, standardized = NULL, unstandardized = !standardized, ...)

Arguments

object

a fitted dfrr-object obtained from invoking the function dfrr.

standardized, unstandardized

a boolean indicating whether stanadrdized/unstandardized residuals are reported. Defaults to standardized=TRUE.

...

dot argument, just for consistency with the generic function

See Also

plot.residuals.dfrr, qq.dfrr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(2000)
N<-50;M<-24

X<-rnorm(N,mean=0)
time<-seq(0,1,length.out=M)
Y<-simulate_simple_dfrr(beta0=function(t){cos(pi*t+pi)},
                        beta1=function(t){2*t},
                        X=X,time=time)
dfrr_fit<-dfrr(Y~X,yind=time)

resid<-residuals(dfrr_fit)

plot(resid)
#qq(dfrr_fit)

asgari-fatemeh/dfrr documentation built on Aug. 12, 2020, 3:06 a.m.