Skip to content

Rounding Issue - using Matrices #3

@gns36

Description

@gns36

Hi! Thanks again for creating this package. I am having a similar rounding issue as another user but slightly different circumstance. I am using matrices to create the lower and upper bounds on my coefficients and then also export those using texresults. However, one of my bounds also has the same rounding issue. I have tried exporting the contents from the matrix as a local, and also rounding the matrix itself. I also updated to Stata18 but am still having this issue. Here is some code that recreates the issue:

`//recreate issue using auto data
sysuse auto, clear
reg mpg trunk foreign

//create matrices to find lower and upper bounds
mat def num = 1.96
mat var = e(V)
local v = var[1,1]
mat se = sqrt(var[1,1])
mat B = e(b)
mat b = B[1,1]
mat lb = b-num*se

//export results
texresults using results.txt, texmacro(lb) result(lb[1,1]) unitzero replace
cat results.txt`

The results show: \newcommand{\lb}{$-0.9500000000000001$}
instead of \newcommand{\lb}{$-0.95$}

Any help solving this issue would be greatly appreciated. Thank you for your time.

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