Added functions for the PCBM and PCBSM

This commit is contained in:
2025-05-26 11:04:03 +02:00
parent 28e43dee33
commit 0a8437fc48
7 changed files with 686 additions and 0 deletions

43
man/pcbm.Rd Normal file
View File

@ -0,0 +1,43 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pcbm.R
\name{pcbm}
\alias{pcbm}
\title{Compute Partial Credit Behavioral Model (PCBSM) for polytomous and dichotomous items}
\usage{
pcbm(
df = NULL,
items = NULL,
grp = NULL,
X = NULL,
dif.items = NULL,
type.dif = NULL,
verbose = T,
fit = "ucminf",
method.theta = "eap"
)
}
\arguments{
\item{df}{data.frame containing the data}
\item{items}{vector containing the names of columns where item responses are stored in df}
\item{grp}{string containing the name of the column where the group membership variable is stored in df}
\item{X}{vector of strings containing the name of additional adjustment variables to be included in the model}
\item{dif.items}{vector containing the list of indexes in "items" corresponding to dif items}
\item{type.dif}{vector containing DIF form for each item specified in dif.items. 1 is homogeneous DIF, 0 is heterogeneous DIF}
\item{verbose}{set to TRUE to print a detailed output, FALSE otherwise}
\item{fit}{string determining the optimization algorithm. Values "ucminf" or "nlminb" ar recommended}
\item{method.theta}{string determining the estimation method for individual latent variable values. Either "eap", "mle" or "wle"}
}
\value{
A data.frame containing various model outputs
}
\description{
This function computes a frequentist PCBM, potentially accounting for DIF on specified items
}

46
man/pcbsm.Rd Normal file
View File

@ -0,0 +1,46 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pcbsm.R
\name{pcbsm}
\alias{pcbsm}
\title{Compute Partial Credit Behavioral Selection Model (PCBSM) for polytomous and dichotomous items}
\usage{
pcbsm(
df = NULL,
items = NULL,
grp = NULL,
u = NULL,
X = NULL,
dif.items = NULL,
type.dif = NULL,
verbose = T,
fit = "ucminf",
method.theta = "eap"
)
}
\arguments{
\item{df}{data.frame containing the data}
\item{items}{vector containing the names of columns where item responses are stored in df}
\item{grp}{string containing the name of the column where the group membership variable is stored in df}
\item{u}{vector of weights to be included in the model as a covariate to account for unobserved confounding. Can be obtained from the "select_weight" function extracting response residuals from a probit model with grp as dependent variable and confounders and instruments as independent variables.}
\item{X}{vector of strings containing the name of additional adjustment variables to be included in the model}
\item{dif.items}{vector containing the list of indexes in "items" corresponding to dif items}
\item{type.dif}{vector containing DIF form for each item specified in dif.items. 1 is homogeneous DIF, 0 is heterogeneous DIF}
\item{verbose}{set to TRUE to print a detailed output, FALSE otherwise}
\item{fit}{string determining the optimization algorithm. Values "ucminf" or "nlminb" ar recommended}
\item{method.theta}{string determining the estimation method for individual latent variable values. Either "eap", "mle" or "wle"}
}
\value{
A data.frame containing various model outputs
}
\description{
This function computes a frequentist PCBSM, potentially accounting for DIF on specified items
}

23
man/select_weight.Rd Normal file
View File

@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/select_weight.R
\name{select_weight}
\alias{select_weight}
\title{Compute confounding weights for the PCBSM.}
\usage{
select_weight(df = NULL, grp = NULL, X = NULL, instr = NULL)
}
\arguments{
\item{df}{data.frame containing the data}
\item{grp}{string containing the name of the column where the group membership variable is stored in df}
\item{X}{vector of strings containing the name of confounders to be included in the model}
\item{instr}{vector of strings containing the name of instrumental variables to be included in the model}
}
\value{
A vector of weights to be included in a PCBSM
}
\description{
This function computes weights to be included in a PCBSM as a covariate accounting for unobserved confounding. Obtained by extracting response residuals from a probit model with grp as dependent variable and confounders and instruments as independent variables.
}