R/vcPB.R
vc.pb.Rd
The vc.pb
offers Peters-Belson(PB) type of nonparametric varying-coefficient regression method which measures the disparity between a majority group
and a minority group for the longitudinal data.
vc.pb(
formula,
group,
data,
id,
modifier = NULL,
local_time = NULL,
bandwidth_M = NULL,
bandwidth_m = NULL,
bandwidth_xM = NULL,
bandwidth_xm = NULL,
bandwidth_Z_M = NULL,
bandwidth_Z_m = NULL,
bandwidth_Z_xM = NULL,
bandwidth_Z_xm = NULL,
detail = FALSE,
...
)
a formula for the model.
a vector within the data
which is used for separating majority and minority groups.
a data frame and data has to be included with the form of data.frame
.
a vector within the data
which is used for identifying the observations.
(optional) a vector from the data
which is an optional argument to add the varying term into the model. The default is NULL
. If the class of the vector is given as
integer
then, the continuous version of vc.PB
is performed and if the class is factor
or character
, then the discrete version is proceeded. Three different sets of
inputs are needed for different versions.
(optional) a vector used for the local points of time variable in the kernel regression.
(optional) a bandwidth for the time variable used for estimating the time-varying coefficient of the majority group.
(optional) a bandwidth for the time variable used for estimating the time-varying coefficient of the minority group.
(optional) a vector of p
number of bandwidths for estimating the local expectations of the design matrix for the majority group.
(optional) a vector of p
number of bandwidths for estimating the local expectations of the design matrix for the minority group.
(optional) a bandwidth for the varying variable used for estimating the time-varying coefficient of the majority group. Used only when the class of modifier
is integer
.
(optional) a bandwidth for the varying variable used for estimating the time-varying coefficient of the minority group. Used only when the class of modifier
is integer
.
(optional) a vector of p
number of bandwidths for estimating the local expectations of the design matrix related to varying variable for the majority group. Used only when the class of modifier
is integer
.
(optional) a vector of p
number of bandwidths for estimating the local expectations of the design matrix related to varying variable for the minority group. Used only when the class of modifier
is integer
.
a bool argument whether the detailed results are provided or not.
used for controlling the others.
vc.pb
returns an object of class "vc.pb"
, which is a list containing
following components:
a matched call.
overall disparity between major and minor groups.
explained disparity between major and minor groups, this component is given only when varying
is null.
explained disparity from the variables without modifier
variable given that the modifier variable is from the majority group, this component is given only when varying
is not null.
explained disparity from modifier
variable, this component is given only when varying
is not null.
unexplained disparity between major and minor groups.
local time points used for kernel regression.
a majority group label.
a minority group label.
the modifier variable and the type of the modifier variable, these components are given only when varying
is not null.
various corresponding bandwidths. Please see the details or the attached reference for more information.
set.seed(1)
n <- 100
x1 <- rnorm(n)
x2 <- rnorm(n)
time <- rep(1:5, 20) + runif(n)
y <- rnorm(n)
sub_id <- rep(1:25, 1, each = 4)
group <- rep(as.character(1:2), 25, each = 2)
z <- as.character(rbinom(n, 1, prob = 0.5))
data <- data.frame(y = y, x1 = x1, x2 = x2, z = z, group = group, time = time, sub_id = sub_id)
fit <- vc.pb(y ~ (x1|time) + x2, data = data, id = sub_id, group = group)
fit
#>
#> Call:
#>
#> vc.pb(formula = y ~ (x1 | time) + x2, group = group, data = data,
#> id = sub_id)
#>
#> Group Variables:
#>
#> Major: 1
#> Minor: 2
#>
#> Disparity Summary Results:
#>
#> t = 1.5198 t = 2.5139 t = 3.5081 t = 4.5022 t = 5.4963
#> Overall Disparity: 0.2391 0.1706 0.0830 -0.3148 -0.2327
#> Explained Disparity: -0.1347 -0.0333 0.0221 0.1179 -0.0367
#> Unexplained Disparity: 0.3738 0.2039 0.0608 -0.4328 -0.1960
#>