Skip to contents

Evaluates the two-sided asymptotic p-value for the Miettinen-Nurminen restricted-maximum-likelihood score test of \(H_0: p_T - p_C = \delta\) in two independent binomial samples (see InferenceIncidMiettinenNurminenRiskDiff for the class that consumes this function). Internally: mn_z_statistic_cpp computes the score \(z\) statistic using the constrained MLEs \(\tilde p_C, \tilde p_T = \tilde p_C + \delta\) (mn_constrained_mle_pc_cpp, found by bisecting the constrained score equation to zero) in place of the unconstrained sample proportions in the variance formula, with a small-sample correction factor \((n_T+n_C)/(n_T+n_C-1)\) applied to the naive binomial variance; this function then returns \(2\,\Phi(-|z|)\), the two-sided normal-tail p-value. Returns NA if either arm is empty, \(\delta\) is outside \((-1, 1)\), or the resulting \(z\) is not finite (e.g. the constrained variance estimate is non-positive).

Usage

mn_pvalue_cpp(x_t, n_t, x_c, n_c, delta, p_t_obs, p_c_obs)

Arguments

x_t

Number of events in treatment.

n_t

Number of subjects in treatment.

x_c

Number of events in control.

n_c

Number of subjects in control.

delta

Null risk difference.

p_t_obs

Observed treatment-arm risk.

p_c_obs

Observed control-arm risk.

Value

The two-sided p-value.