Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to perform one-sample and two-sample z-test?

    I seem to be having some trouble using the ztesti command.


    Code:
    ztesti 1305 35.3111 15.4512 35, level(95)
    Keying in that input gives me a two sample test, rather than a one-sample test.
    Does anyone know why this is happening?

  • #2
    Thevesh:
    welcome to the list.
    you have to compare your sample against something and see whether the null should be rejected or not.
    If you have one sample only, you should usually compare (say) your sample mean with the population mean, taking population sd into account (see -help ztest-).
    I suspect the you mixed up two different notions: one sample and one-tailed confidence interval.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thevesh,
      you did get a one-sample test of 35.3 against 35; note in the output below that it actually tells you that:
      Code:
      . ztesti 1305 35.3111 15.4512 35, level(95)
      
      One-sample z test
      ------------------------------------------------------------------------------
               |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
      ---------+--------------------------------------------------------------------
             x |   1,305     35.3111    .4277174     15.4512    34.47279    36.14941
      ------------------------------------------------------------------------------
          mean = mean(x)                                                z =   0.7273
      Ho: mean = 35                                    
      
          Ha: mean < 35               Ha: mean != 35                 Ha: mean > 35
       Pr(Z < z) = 0.7665         Pr(|Z| > |z|) = 0.4670          Pr(Z > z) = 0.2335
      so, your question is confusing as your command gives what you say you want; please clarify

      Comment

      Working...
      X