[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: dirifit |

Date |
Wed, 5 Mar 2008 21:07:54 -0000 |

Let me try to handle this so that Maarten can write another paragraph of his Ph.D. (He should just submit his contributions to Statalist as evidence.) I am the second author of -dirifit-, or at least that's what it tells me in the help. Last question first: The short answer is No, not in general. This is a much asked question on this list. -findit precision- in Stata points to documentation, but the essence is this: A decimal number can be held exactly in Stata if and only if it corresponds to a binary number that can be held exactly. Thus 0.5 qualifies, for example, but most decimals don't. First question last. -dirifit- tries, among other things, to ignore observations in which any response is 0 or 1. No precision issues arise with holding zeros and ones. Computers are designed for precisely (nice word here) that purpose. That leaves the question of totals which Viktor very reasonably raises. Let's look at the code. Segment 1: foreach var of varlist `varlist' { local test "`test' | `var' <= 0 | `var' >= 1" } Comment 1: The inequalities also include <0 and >1, but neither extension should be problematic. Segment 2: tempname tot qui gen double `tot' = 0 if `touse' qui foreach v of local varlist { replace `tot' = `tot' + cond(missing(`v'),0,`v') if `touse' } qui count if (`tot' < .99 | `tot' > 1.01 `test') & `touse' if r(N) { noi di " " noi di as txt /// "{p}warning: {res:`varlist'} has `r(N)' values <= 0 or >= 1" noi di as txt /// " or rowtotal(`varlist') != 1; not used in calculations{p_end}" } qui replace `touse' = 0 if `tot' < .99 | `tot' > 1.01 `test' qui count if `touse' if r(N) == 0 error 2000 Comment 2: There is in fact a tolerance built in here to match any worries about precision. If your totals are under .99 or above 1.01, they will be trapped _and_ you will be told about it. If the results remain puzzling, I suggesting emailing the dataset to Maarten or myself. Nick n.j.cox@durham.ac.uk viktor.slavtchev@uni-jena.de I want to explain the share of time that individuals spent on five distinct alternatives (y1 - y5). Hence y1+y2+y3+y4+y5=1. Therefore I run: dirifit y1-y5, mu(x1 x2) It works, however, for only 60 cases out of more than 500. That is, the estimation is done for 60 cases. Could it be that the -float- character of the dependent variable causes that problem? I am just wondering whether the possibility exists that the sum of y (=y1+y2+y3+y4+y5) becomes slightly lower or slightly larger than one when the dependent is -float-. -dirifit- can be estimated only if the sum is one. Is there a possibility to transform the variables in the way that 0.2534 is exactly 0.2534 and not 0.253(3)9 or 0.2534(0)1? * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: dirifit***From:*Viktor Slavtchev <viktor.slavtchev@uni-jena.de>

**References**:**Re: st: dirifit***From:*Maarten buis <maartenbuis@yahoo.co.uk>

**Re: st: dirifit***From:*"viktor.slavtchev@uni-jena.de" <viktor.slavtchev@uni-jena.de>

- Prev by Date:
**st: -hhset- hrespnr?** - Next by Date:
**st: RE: -hhset- hrespnr?** - Previous by thread:
**Re: st: dirifit** - Next by thread:
**st: dirifit** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |