Statalist The Stata Listserver

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

Reinstalling packages was ---Re: st: Re: -firstdigit- available fromSSC----

From   Ronnie Babigumira <>
Subject   Reinstalling packages was ---Re: st: Re: -firstdigit- available fromSSC----
Date   Mon, 28 May 2007 11:20:12 +0200

The list of (unofficial) user-written ado files is very long and I doubt you will want to install all of them.

If you would like to reinstall the ones you installed before reinstalling your Stata system. You would need to have a record of the packages you had installed (you could have used -ado dir-, -adolist- to do this)

All that said, I am not sure whether uninstalling Stata also removes the directory in which these unofficial ado's are stored. You can check where your unofficial stuff is using -sysdir- and you can check to see if your packages are still on the system by running -ado dir-

Hope this helps

Zou Hong wrote:

Dear All,

I have reinstalled my Stata system and run "update all" in Stata.

I wonder whether there is a simply way to identify and install all (unofficial) user-written ado files (like ivreg2 and xtabond2 and many others).

Many thanks

----- Original Message ----- From: "Nick Cox" <>
To: <>
Cc: <>
Sent: Thursday, May 24, 2007 12:03 AM
Subject: st: -firstdigit- available from SSC

Thanks to Kit Baum, a new package -firstdigit-
is now available from SSC. Stata 9 is required,
as the program depends on Mata. Use -ssc-
to install if interested.

-firstdigit- tabulates and analyses the first
digits of numeric variables. It also tests
Benford's law that digits d = 1,..,9 occur
with probabilities log10(1 + 1/d). Thus given
data of 12, 345, 6789, etc., it would extract
1, 3, 6, etc., tabulate the frequencies of
the digits 1 to 9 and give a chi-square test
of the law.

Users of Stata 8 may wish to look at -benford-
by Nikos Askitas, also available from SSC
(and revised today).

Alternatively, users of Stata 8 may use -chitest-
from the package -tab_chi-, also available from
SSC, for this purpose. The help details a Benford's
Law example.

Mata users may be interested to see how the main
work goes in Mata:

void fd_work(string scalar varname,
string scalar tousename,
string scalar percent)
real colvector y, obs, exp
real scalar n, i, chisq
string scalar name

y = st_data(., varname, tousename)
n = rows(y)
exp = obs = J(9, 1, 0)

y = strtoreal(substr(strofreal(y), 1, 1))

for (i = 1; i <= 9; i++) {
obs[i] = colsum(y :== i)
exp[i] = n * log10(1 + 1/i)
name = "r(obs" + strofreal(i) + ")"
percent == "" ? obs[i] : 100 * obs[i] / n)
name = "r(exp" + strofreal(i) + ")"
percent == "" ? exp[i] : 100 * log10(1 + 1/i))

chisq = colsum(((obs - exp):^2) :/ exp)
st_numscalar("r(p)", chi2tail(8, chisq))
st_numscalar("r(chisq)", chisq)
st_numscalar("r(N)", n)


* For searches and help try:

*   For searches and help try:

*   For searches and help try:

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