Skip to content

One-tailed test branches do not assign pval output variable #199

@phychi

Description

@phychi

In the ztest.m, when performing one-tailed tests ("right" or "left"), the calculated p-value is stored in a local variable p but never assigned to the output variable pval. This causes the function to return an error.

x = normrnd(10, 2, 100, 1);
[h, pval] = ztest(x, 10, 2, "tail", "right");

disp("Hypothesis test result (h): "), disp(h);
disp("p-value: "), disp(pval);
>> my

error: 'pval' undefined near line 152, column 15
error: called from
    ztest at line 152 column 3
    my at line 5 column 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions