Skip to content

Test generate_response_vector_linear properly without setting high tolerance #20

@eliwangj

Description

@eliwangj

Description:

Now in function generate_response_vector_linear we use np.random.randn to generate random error terms from the standard normal distribution. This creates a problem for its pytest function: Ideally we want to compare the actual value and the theoretical value of the response vector. However, now we have this random error term which can be any value in theory. Even though 95% of chance it will fall into [-1.96, 1.96], if the betas or the column values are small, it can still have a huge impact on the magnitude of the response vector. Raised in #19.

Question:
How do we test the function generate_response_vector_linear works given the problem stated above?

Current compromised solution:
I set a high tolerance for the sample response value.

Possible solutions:

  1. Get around and do not test by comparing the values.
  2. Set a random seed to fix the error terms.
  3. Create an instance variable response_vector_w/o_error to store the response vectors without random error term.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions