In a normal linear model with an intercept, observations and independent mean coefficients, adjusted is
It compares the residual variance estimate with the unmodelled sample variance, adjusting the raw coefficient of determination for fitted dimension. It can be negative and is not guaranteed to increase when another regressor is added. In penalized regression a related convention uses the fit's effective degrees of freedom instead of ; the precise smoothing-software variance convention should be specified.
Let be real independent and identically distributed random variables, with mean , variance and finite fourth central moment . For the sample variance , the displayed convergence in distribution holds.
Indeed . The central limit theorem for the sample mean implies that tends to zero in probability. Changing the divisor from to also has negligible effect at this scale, by the law of large numbers. Apply the central limit theorem to the independent variables , whose variance is , and use Slutsky's theorem. Standardization gives a standard normal distribution limit when . The familiar special case holds for the normal distribution because then .
Take the original observations , with sample mean . All ordered bootstrap samples have probability . The bootstrap sample has sample mean ; has sample mean ; has sample mean . These are illustrative possibilities, not three simulated measurements used to estimate the distribution.
For bootstrap count vectors , records the number of copies of observed slot . Their multinomial distribution is
and . Thus the unordered counts have probability , whereas have probability . Stars and bars gives ten count vectors, but assigning each probability would be wrong. Two different count vectors, and , both give sample mean ; combining their probabilities gives .
Figure 1.
Exact conditional sampling distribution of the sample mean from observations
. All 27 ordered bootstrap samples are enumerated. Bar labels give their counts out of 27, not empirical frequencies from a random simulation. The dashed line marks ; the gaps reflect this discrete three-point empirical measure. Details.
The conditional bootstrap variance of a sample mean gives a compact check on the enumeration. Each resampled draw has expected value and variance
Averaging three independent draws divides that variance by three:
The exact conditional bootstrap standard error is . The original sample variance with denominator is , so its usual estimated standard error for the sample mean is . Their squared ratio is here; the difference follows from the empirical measure's denominator , not a numerical simulation error. Neither number is the known true sampling standard error of the unknown source probability distribution.
For an independent normal sample with common mean and positive variance , its sample mean and sample variance are independent. Indeed, the mean and residual vector are jointly multivariate normal, and . Vanishing cross-covariance between jointly Gaussian blocks proves independence of the mean from the entire residual vector. Since the sample variance is a measurable function of that vector, independence follows. Independence from each coordinate separately would not suffice without the joint Gaussian argument.
Jackknife bias correction Created 2026-09-24 Updated 2026-10-14
The jackknife bias correction uses jackknife resampling to estimate and subtract the bias of an estimator. Here denotes the original estimator, its version after deleting observation , and the mean of those versions. For sample size , define
The sign matters: a negative estimated bias increases the corrected value. The original estimator and all deletion versions must target the same estimand and use the same estimation rule at their respective sample sizes. The definition alone does not make an unbiased estimator.
For an exact worked example, take the empirical variance
On , the sample mean is and . Each deletion empirical variance is recomputed around its own deletion sample mean, with divisor , giving
For instance, deleting leaves , whose sample mean is and whose empirical variance is . The correction on the full statistical sample is
The same data thus give a jackknife variance estimator of for the sample mean, and a corrected empirical variance of ; these are different estimands.
Figure 1.
Two uses of the same deletions: sampling variance and jackknife bias correction
. The left panel plots contributions to the jackknife variance estimator of the sample mean, summing to . The right panel plots the five deletion empirical variances and their mean , then compares the original empirical variance with the corrected sample variance . Details.
The exact equality with the usual sample variance is not an accident of these numbers. For any data with , write . Removing changes this sum to , so
For independent and identically distributed random variables with finite second moment and population variance , the expectation is . Its bias is exactly ; jackknife bias correction removes it exactly in this example. Thus is an unbiased estimator of under these assumptions, including where each deletion empirical variance is zero.
More generally, suppose the bias has a regular expansion at both sample sizes and , with coefficients independent of :
Under independent and identically distributed sampling, each deletion estimator has the same expectation as . Hence the corrected bias is
The leading term cancels; the remaining bias need not vanish. The notation is big O notation. This argument presumes the expansion, rather than proving it for every statistic; the regularity conditions discussed for the jackknife variance estimator and statistical dependence still require care. Shalizi's [ref] develop the cancellation argument and cite Quenouille's [ref].
The jackknife variance estimator estimates the sampling variance of the full-data estimator, using the deletion estimates and their mean from jackknife resampling:
The square root is the estimated standard error. The factor multiplies the divisor- variance of the deletion estimates: those estimates vary less than estimates from new independent experiments because almost all their observations are shared. Ryan Tibshirani's [ref] give the same scaling in terms of the divisor- sample variance of the deletion estimates.
For the sample mean, this formula has an exact algebraic simplification. With denoting the usual sample variance,
and therefore
Under the independent and identically distributed assumption and a finite second moment, is an unbiased estimator of the population variance . Consequently is an unbiased estimator of the sample mean's sampling variance . The equality itself holds for any observed data with ; its sampling interpretation uses the stated assumptions.
For , the sum of squared deviations from the sample mean is , giving sample variance . The deletion sample means have squared deviations totaling , so
Here estimates the variance of individual observations, while estimates the sampling variance of their sample mean. These answer different questions.
For more general statistics, validity requires regularity beyond the deletion formula, such as a sufficiently smooth function of sample means with suitable moments. Ordinary delete-one jackknife resampling can fail for nonsmooth quantiles, including the median; see Larry Wasserman's [ref]. With statistical dependence, deleting individual observations need not reproduce the relevant sampling variance; the deletion scheme must reflect that statistical dependence. Shalizi's [ref] distinguish the basic independent and identically distributed case from extensions.
Law of total variance Created 2026-09-24 Updated 2026-10-14
The law of total variance separates the spread of a population into spread inside groups and spread between their means. For a real square-integrable random variable , so that , and another random variable on the same probability space,
The first term averages the conditional variance over the possible information ; the second measures how much the conditional mean changes with that information. There is no independence assumption, and need not be numerical or have finite variance. Conditioning is useful precisely when knowing tells us something about . See MIT tutorial on using conditional expectation and variance.
More generally, the available information can be a sub-sigma-algebra of the ambient probability space. With , the existing conditional expectation definition gives
Taking recovers the displayed formula. The conditional mean and conditional variance are themselves random variables: before learning the group, we do not yet know which group average or group spread will apply. Their outer expectation and variance turn these varying quantities into numbers.
For a fully explicit mixture distribution, choose a group or with equal probabilities. In group , choose or with equal conditional probabilities; in group , choose or with equal conditional probabilities. Thus the complete joint probability distribution consists of , each with probability , and no other outcomes. The conditional means are and . Squaring the deviations and gives conditional variances and , respectively. The law of total expectation gives the overall mean .
The within-group contribution to variance is
For the between-group contribution, the conditional mean takes values and , each three units from the overall mean. Consequently,
We can check this without any conditioning: the discrete random variable takes values with equal probabilities, so
Equivalently, its second moment is , and subtracting the squared mean gives . These are population variances, with the stated probabilities as weights, rather than estimates using the corrected denominator of a sample variance.
Figure 1.
Four equally likely outcomes split total variance into within-group 5 and between-group 9
. Details.
The figure makes the two sources of spread visible. The outcomes in group cluster tightly around , while those in group sit farther apart around . Replacing every outcome by its conditional mean removes the internal spread but leaves the separation between groups. Conversely, subtracting each group's conditional mean aligns the two groups around zero. Averaging only the conditional variances would miss nine units of variance; retaining only the conditional means would miss five. Neither summary alone describes the whole population.
Two modifications clarify what each contribution measures. Shift group to outcomes and group to outcomes , keeping all four probabilities equal. Both conditional means are now , while the conditional variances remain . The between-group contribution vanishes, and total variance is just . Group membership still tells us how uncertain an outcome is, even though the best point prediction stays the same. Alternatively, let every outcome in group equal and every outcome in group equal . Now both conditional variances vanish, and all nine units of total variance come from group separation. Knowing the group predicts the outcome perfectly. These limiting cases distinguish differences in average outcome from differences in internal spread; the original mixture distribution contains both.
The same calculation answers a prediction question. If the group is hidden, the best constant prediction is the overall mean , with mean squared error , by variance as the minimum mean squared error of a constant. If the group is revealed, predict for and for . The errors become , and their mean squared error is . Knowing the group therefore improves the best achievable mean squared error by , exactly the between-group contribution. This is an interpretation relative to the information available: the remaining uncertainty could shrink further if additional information were revealed.
For any square-integrable measurable function used as a predictor, write . The prediction identity is
Thus predicting with the regression function gives the conditional expectation and minimizes mean squared error over every permitted predictor, including nonlinear ones. This minimizes average squared error, not the error for each individual outcome. See Berkeley Statistics 201A notes, sections 36–37.
Why do the two pieces add cleanly? Put . Its conditional expectation given is zero, so and for every square-integrable measurable function . In particular, and are uncorrelated random variables. Splitting and squaring therefore leaves no cross term after taking expectation. Geometrically, the conditional expectation is an orthogonal projection in the L2 space, and the law of total variance is its Pythagorean theorem for centered random variables.
Figure 2.
Conditional prediction leaves zero group means but different residual spreads
. Details.
In our example, the four products are , which average to zero. Yet and are not independent: observing identifies group , while observing identifies group . This is a concrete instance of heteroscedasticity, with different conditional variances despite zero conditional means of the errors. A group can predict uncertainty even when it cannot predict the error's sign.
The law of total variance is useful whenever aggregated data conceal distinct groups. Changing mixture weights changes both contributions, so the weighting must match the population being described. For example, giving group weight changes the overall mean to , the within-group variance contribution to , and the between-group contribution to , making the total . Group differences account for spread and prediction gains; assigning them a causal explanation requires a separate causal inference argument.
Lilliefors test 2026-10-14
The Lilliefors test calibrates the Kolmogorov-Smirnov statistic against a normal distribution whose mean and variance are estimated from the tested observations. In the original procedure, is the sample variance with denominator , and is the standard normal distribution function. Its reference law includes this fitting step. The original paper's opening procedure and Table 1 explain the changed calibration.[ref]
Normal mean confidence interval with known variance Created 2026-10-14 Updated 2026-10-25
Suppose are independent and identically distributed with normal distribution , where the mean is unknown and the standard deviation is known. The sample mean has normal distribution and standard error . With the standard normal quantile at , the displayed confidence interval has exact coverage probability for every and every positive integer . No central limit theorem approximation is needed.
Take , and nominal confidence 95%. The standard error is , and . Therefore
Rounded for reporting, this is . If , the realized confidence interval is approximately . Exact 95% calibration refers to the unrounded standard normal quantile; using literally gives coverage probability , almost but not exactly 0.95.
The confidence interval's width scales as : increasing sample size from 16 to 64 halves its half-width to . If is unknown, merely substituting the square root of a sample variance loses the displayed exact calibration; for the same normal distribution model, use a Student t confidence interval.
The figure holds the true mean at and independently generates 40 samples of 16 observations from the same normal distribution. NumPy's PCG64 generator with seed 42 gives 39 covering confidence intervals and one miss, at sample 32: observed coverage is . Every bar uses the unrounded standard normal quantile. This finite collection illustrates the moving endpoints; it does not establish the analytic coverage probability or require exactly two misses.
Figure 1.
Forty normal-mean confidence intervals and their exact 95% coverage event
. Details.
The beauty of the construction is that a familiar standard normal distribution calibrates every possible unknown mean at once. For a short proof, the pivotal quantity
has a probability distribution independent of . The event has probability ; rearranging it gives . The right panel shows the equivalent event when .
Place observations in rows of the data matrix . Since the coordinate sample means are zero, the Gram matrix of its columns is
The sample covariance matrix is ; using divisor three instead changes eigenvalues by a common factor and leaves principal component loadings unchanged. For , the characteristic polynomial is
For the larger eigenvalue , the eigenvector equation gives , so . Normalize to unit Euclidean norm and choose . An orthogonal unit eigenvector for is . Therefore
The sample variances of these principal components are and , respectively. Their principal component scores for observations are
Either eigenvector may be multiplied by without changing its principal component direction or its variance. No coordinate standardization is applied here: that would instead be principal component analysis on a correlation matrix.
Let be the number of failures in mix . The total observed failures are among blocks. Equal marginal failure probabilities give , regardless of dependence within a mix. Thus the unbiased estimator based on grouped Bernoulli failure counts is
For a conventional binomial confidence interval, additionally assume independent block outcomes. Then the total has binomial distribution and the estimated standard error is . The normal approximation gives the approximate 95 percent interval
One can instead obtain an exact, generally conservative binomial interval by solving and for the two endpoints. These equations invert binomial tail tests.
Equal marginal probabilities alone do not imply independent blocks. If the mixes are independent but blocks within a mix can be dependent, use the sample variance of the 100 counts. Here and , so . The estimated variance of is ; its standard error is , giving the large-sample interval approximately . If even between-mix independence is absent, no stated model justifies either numerical coverage claim. The estimate remains unbiased, but the uncertainty calculation needs its sampling assumptions.
The command centres the log measurements and performs principal component analysis of their covariance matrix. With cor=F, it does not first standardize the variables to variance one. For a unit principal component loading vector , the score has sample variance . By the spectral theorem for real symmetric matrices, expand in an orthonormal eigenbasis; that variance is a weighted average of the eigenvalues. Its maximum is the largest eigenvalue, reached at the corresponding eigenvector. Repeating subject to orthogonality to previous directions gives the other principal components.
The software uses the divisor- sample covariance matrix for its component standard deviations, whereas var used divisor . Diagonalizing the displayed matrix gives approximately
Taking square roots of the latter gives , agreeing with the output to the rounding of the displayed sample covariance matrix. The normalization changes these numerical standard deviations but leaves the eigenvectors and proportions of explained variance of a principal component unchanged.
The first principal component explains about of the total log-variable variance, the second another , and the last about . Keeping two preserves about . An original scree plot displays the sharp drop after the first component:
Figure 1.
Principal-component variances and cumulative explained variance for the log-tree measurements
. Details.
Consequently the centered cloud is very elongated along one direction: a one-dimensional approximation represents almost all of its squared variation. From the displayed covariance matrix, a unit first eigenvector, with its arbitrary sign chosen positive, is approximately
Its principal component score is therefore . All coefficients have the same sign, so this direction describes overall tree size, with log volume dominating the unstandardized variation. The summary alone supplies proportions, not the loading directions; the displayed sample covariance matrix supplies the latter. This is a geometric approximation, not evidence of an exact deterministic relation or independent original variables.
One further use is principal component analysis on a correlation matrix, obtained with cor=T, which equalizes marginal variances and answers a different scaling-sensitive question. Another is principal component regression: fit a response to selected principal component scores rather than highly correlated original predictors, choosing the number using prediction assessment. The fitted transformation also projects new measurements into the same low-dimensional coordinates, provided the training centering and scaling are retained.
Take logarithms entry by entry before centering. For tree , let , and put . The command var(log(b)) computes the sample covariance matrix with the unbiased estimator normalization
Thus entry is the sum of products of the centered log measurements divided by , not the logarithm of the covariance between the original measurements. Its diagonal entries are the three log-variable sample variances, and the off-diagonal entries are their sample covariances. The positive off-diagonal entries indicate positive association of the log measurements. Taking logarithms turns a multiplicative relation such as into the approximately linear relation , which motivates investigating principal components of these transformed observations.
The first output uses the equal-variance, pooled Student's t-test, as shown by its seven statistical degrees of freedom. Its exact model assumes two independent samples from normal distributions, with means and a common unknown variance . The hypotheses are against . The sample means are and , and the unbiased within-sample sample variances are
The pooled sample variance and its resulting standard error are
Hence
To justify its reference distribution, under the null is standard normal, while is , independently of the two sample means. Dividing the first variable by the square root of the second divided by seven gives the exact pooled two-sample t statistic, with Student t-distribution . Its one-sided p-value is the lower tail
The associated one-sided 95% confidence interval for is
The printed missing lower bound means that this is a one-sided upper confidence limit, not that a finite lower endpoint should be estimated. With such small samples the normality and common-variance assumptions matter; a Welch analysis would use a different variance estimate and generally different degrees of freedom.
The second output is the Wilcoxon rank sum test for two independent continuous samples. Under a common-distribution null hypothesis, labels are exchangeable conditional on the pooled values, so the four ranks assigned to the first sample form a uniformly chosen four-element subset of . The first sample receives ranks , giving raw rank sum
Equivalently the Mann–Whitney U test statistic is , the number of cross-sample pairs with an observation larger than a observation. This output reports the raw rank sum, rather than the shifted statistic used by some software.
A first sample tending to be smaller has a small rank sum. Under the null, all rank allocations have equal probability. Only and have rank sum at most 11. By the exact rank-sum tail one above the minimum, the exact lower-tail p-value is
No large-sample normal approximation or continuity correction is involved; the absence of ties makes this simple enumeration valid. For a common-shape location-shift family, the test's alternative is a negative location shift of relative to . Without that model, the null is equality of distributions and the rank comparison is not simply a test of equality of means or medians.
Both tests reject at the 5% level in the direction of smaller observations; only the pooled t-test rejects at 1%. The t-test uses the numerical spacing and targets a mean difference under its normal model. The rank-sum test uses ordering and an exact exchangeability calculation, avoiding the normality and common-normal-variance assumptions. Their different p-values therefore reflect both different statistics and different modelling assumptions, not a numerical contradiction.
The empirical distribution function is . For continuous F, the probability integral transform gives independent uniform variables . Strict increase of F is unnecessary. More explicitly, generate the observations by with the generalized quantile inverse. Then , so , where is the uniform empirical distribution.
Continuity and the limits of F ensure that its range contains . The endpoint discrepancies for are zero. Hence
which depends only on n. Equivalently it is , a function of uniform order statistics. This proves the distribution-free property of the Kolmogorov-Smirnov statistic even when F has flat portions.
Choose from this common distribution so that . The Kolmogorov-Smirnov confidence band is
The event that all these inequalities hold is exactly the event used to choose the critical value, giving simultaneous coverage . The Glivenko-Cantelli theorem states that for an independent identically distributed sample from any distribution function, continuous or not, almost surely.
For an integrable r-argument U-statistic kernel, replace it by . Every permutation has the same expectation by exchangeability, so this symmetrization of a U-statistic kernel preserves the target functional. For a symmetric U-statistic kernel h and , the U-statistic is
Each summand has expectation theta, hence the statistic is unbiased.
For the population variance, use . Independence gives when the second moment is finite. The corresponding statistic simplifies using :
Thus variance as a U-statistic is precisely the usual unbiased sample variance, for .
For the sample, put and use the sample covariance matrix
Order its eigenvalues decreasingly and choose unit orthogonal eigenvectors . The sample principal components are the score columns
Their sample means are zero and their sample covariance is diagonal, since . The th sample variance is , and its explained variance of a principal component is . Using divisor instead changes the numerical variances by a common factor but leaves the component directions unchanged.
Standardizing means replacing a variable with positive sample variance by . This gives principal component analysis on a correlation matrix, using with . It removes arbitrary differences of measurement units and prevents a large-variance coordinate from dominating solely through its scale. It also changes the question being optimized: small-variance and possibly noisy coordinates receive equal marginal weight. Principal component analysis based on the covariance matrix can be more appropriate when the variables have common meaningful units and absolute variability matters. Standardization is therefore a substantive choice, not an automatic improvement. A zero-variance variable must first be removed. In the word-rating example the variables share the same numerical range, but their across-word dispersions can differ; standardization gives each attribute equal initial variance.
For the standardized eight-variable analysis, total variance is . The first three fractions of explained variance of a principal component are approximately 59.6%, 19.1% and 10.1%, respectively. The first two account for about 78.8%, and the first three for 88.9%. The first direction is dominant but one direction alone loses substantial variation. Retaining two principal components is a plausible descriptive summary: their eigenvalues exceed , whereas the third is below . That cutoff is a heuristic, and the third principal component may still have interpretable content.
The reported coefficient rows are not unit-length vectors. The printed rounded rows have squared lengths , and , consistent with their eigenvalues to the precision of the coefficient table. They are consistent with the scaled principal component loading convention . Such rows remain eigenvectors, but the score direction with unit length is , or more accurately the row divided by its actual Euclidean norm when using rounded entries. Under this convention is the correlation of standardized attribute with the variance-one score for component :
This explains both their sizes and why they must not be treated as the unit vectors from parts (i) and (ii).
The first principal component has positive coefficients on every attribute, strongest on friendliness, goodness, niceness, bravery and strength. With the favorable endpoints coded in the positive direction, it describes a broad favorable or impressive evaluation, with a potency contribution. The second contrasts movement and speed, with some size and strength, against the first three evaluative attributes; it is chiefly an activity dimension. The third is dominated by size, with smaller positive strength and negative movement/speed coefficients, distinguishing size or potency from activity. These are interpretations of directions of variation, not evidence of causal latent traits. Reversing a principal component's overall sign changes neither its meaning as an axis nor its explained variance; endpoint coding fixes only how its positive side is described.
Write for two rows of the data matrix and . Three possible dissimilarities for continuous variables are the following.
The Euclidean distance is
It is simple and has the usual geometric interpretation when coordinates have comparable units. Its disadvantage is sensitivity to the numerical scales: a change of units or a high-variance variable can dominate it. Strongly correlated coordinates can also give repeated weight to essentially the same information. Squared Euclidean distance is useful in some methods, but is not itself a metric because it need not satisfy the triangle inequality.
The standardized Euclidean distance is
where is the sample variance of coordinate across individuals. It measures differences in standard-deviation units and is invariant under positive coordinate rescalings when the scales are estimated consistently. It is useful for differently measured variables, but requires nonzero sample variances, ignores correlations between coordinates and can give excessive influence to a low-variance noisy variable. With fixed positive scales it is a Euclidean distance after a diagonal change of coordinates, so it is a metric.
The Mahalanobis distance is
where is the pooled sample covariance matrix of all individuals. If is its Cholesky decomposition, then : it is Euclidean distance in whitened coordinates. It adjusts for both scales and correlations, avoiding duplicate weight for highly correlated variables, and is invariant under nonsingular affine transformations when the sample covariance matrix is transformed accordingly. No multivariate normal distribution assumption is required merely to define the distance. However, must be a positive-definite matrix; when there are too few observations or dependent coordinates, its inverse is unavailable. Estimation of can also be unstable and sensitive to outliers. These trade-offs determine whether covariance adjustment is preferable to the simpler distances.
Set , and . The fourth-moment assumption makes finite, so the variance of a sample mean is . Assume , as required for leave-one-out estimation.
The Jackknife variance estimator recomputes the original statistic on each sample with one observation removed. Here
By the definition of the Jackknife variance estimator,
For completeness, expanding the centered sum gives
Consequently . The jackknife variance estimator is unbiased for this statistic. This calculation uses only the finite fourth moment, not normality of the original observations.
Given the observed data, put and . The empirical distribution assigns mass to each observed , including repeated values with their multiplicities. A bootstrap sample consists of independent draws from this distribution, with replacement. The nonparametric bootstrap variance estimate is the conditional variance
Independence of the bootstrap draws gives the exact conditional bootstrap variance of a sample mean:
Thus its finite-sample expectation is , in contrast to the unbiased jackknife estimate. This is the jackknife and bootstrap variance of a sample second moment scaling difference.
To approximate it by Monte Carlo simulation, independently generate bootstrap samples. For replicate , choose independent uniform indices and compute . With , use
For this is conditionally unbiased for the bootstrap variance and converges to it as . Uniform indices can be obtained by for uniforms on .
Let be the conditional bootstrap distribution of the statistic. A nominal level percentile bootstrap confidence interval is
Reuse the bootstrap replicates, sort them as , and take the order statistics with ranks and as empirical quantiles. These are quantiles of the statistic itself, rather than reflected quantiles of its centered error. Increasing reduces simulation error; it does not turn an approximate confidence interval into an exact finite-sample one.
An analytic alternative follows from the central limit theorem. If , then , and the sample variance converges to by the strong law of large numbers. The Slutsky theorem therefore gives the large-sample normal approximation interval
where is the standard normal quantile. Its lower endpoint may be truncated to zero because the parameter is nonnegative. If , almost surely and the statistic identifies the parameter exactly; the interval degenerates to that value. The nondegenerate normal interval is asymptotic, not an exact Student interval under arbitrary .
The first matrix contains the leave-one-out samples, and each element of vect is their sample mean. For ,
Thus R4a computes the jackknife variance estimator of the full sample mean:
where is the unbiased sample variance. R5a computes the estimated bias used in jackknife bias correction. The identity for the average leave-one-out sample mean gives R5a = 0, apart from floating-point rounding.
The second printed loop contains an indexing error: its row index is i, although its loop variable is b. Literally, after the first block, i equals . When , every iteration overwrites row of the new matrix; the other rows remain missing. Hence vect contains one finite mean and 198 missing entries. R's default sorting removes missing entries, leaving a vector of length one, so selecting its fifth and 195th entries gives R7b = c(NA, NA). If , the matrix assignment is out of bounds; if the second block runs independently with i undefined, it fails even earlier. This is a source error, not a property of the bootstrap.
Replacing just the row index by b gives the intended algorithm: draw 199 independent bootstrap samples and sort their sample means as . The two indices are and , so
These are the endpoints of an approximate 95% percentile bootstrap confidence interval for the population mean. Their actual numerical values depend on the supplied data and random draws, which are not specified. They are not the reflected endpoints of a basic bootstrap confidence interval, and the choice of ranks does not guarantee exact finite-sample coverage.