Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: summation


From   "Dominic Muston" <[email protected]>
To   <[email protected]>, <[email protected]>
Subject   Re: st: RE: summation
Date   Mon, 12 Dec 2005 09:25:38 +0000

Can this problem be simplified with a standard summation formula?

The sum from 1 to n in steps of 1 is 0.5 x n x (n+1).

Your problem appears like it might be a summation from 10*(min-1) to
10*(max-1) in steps of 10, which I think would have a formula of:

	5 x ((max-1) * max - (min - 2) * (min - 1))

eg min = 2, max = 20 => sum = 5 x ( 19 x 20 - 0 x 1 ) = 1900.

The method doesn't work with your other example as I see that you have
treated missing as zero. As you can see, the formula ignores all your
data other than min and max, so if these are important, then the formula
might not work for you.





A. Mushfiq Mobarak, Assistant Professor of Economics

> I post a part of my dataset below.  I would like to sum the variable
> "length" from n=min to n=max for each state, where n, min and 
> max are 3
> different variables.  I'm using Stata8SE. 
> 
> So, for example, for state=1, the answer I'm looking for would be:
> 
> summation (n going from 2 to 20) of "length', which equals
> 10+20+30+....+190 = 1900
> 
> For state=3, the answer would be summation (n going from 6 to 16) of
> length = 50+60+.+150 = 1100
> 
> For state=2, I would just get "." (missing)
> 
> This is a very large dataset, which is why I need to automate the
> summing procedure. I apologize in advance if the answer is obvious. 
I
> will be grateful for any help or suggestions.  I subscribe to 
> the digest
> version, so copying the response to [email protected] 
> (hitting "reply
> all" rather than "reply" may also work) will help me get your
response
> quicker.
> 
> group	n	min	max	state	length
> 3	2	2	20	1	10
> 3	3	.	.	2	20
> 3	4	2	20	1	30
> 3	5	2	20	1	40
> 3	6	6	16	3	50
> 3	7	2	20	1	60
> 3	8	6	16	3	70
> 3	9	2	20	1	80
> 3	10	6	16	3	90
> 3	11	2	20	1	100
> 3	12	6	16	3	110
> 3	13	2	20	1	120
> 3	14	6	16	3	130
> 3	15	2	20	1	140
> 3	16	6	16	3	150
> 3	17	17	25	4	160
> 3	18	2	20	1	170
> 3	19	17	25	4	180
> 3	20	2	20	1	190
> 3	21	17	25	4	200
> 3	22	22	28	5	210
> 3	23	17	25	6	220
> 3	24	22	28	5	230
> 3	25	17	25	6	240
> 3	26	22	28	5	250
> 3	27	.	.	7	260
> 3	28	22	28	5	270

*
*   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/ 

------------------------------

Date: Fri, 9 Dec 2005 13:13:40 -0000
From: "Nick Cox" <[email protected]>
Subject: st: RE: [question about testing for normality]

Please use informative titles for your posts. 

Nothing in this question looks unique to econometrics. 

It all depends what you want to do with 
the distributions in question, which you do not say. 

Otherwise my advice is that given earlier
this week to a questioner about -sktest-. 

Nick 
[email protected] 

Isabel Vargas
 
> Please I have a econometric question not exactly about stata.
> I am working with cross-section data, and I use swilk 
> sfrancia and iqr and I
> found that it reject normality, it is serious? If it is, what 
> can I do?

*
*   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/ 

------------------------------

Date: Fri, 09 Dec 2005 12:25:04 -0200
From: Fernando Augusto Proietti <[email protected]>
Subject: st: How ?

This is a multi-part message in MIME format.
- --------------239F3F5331B035C3ECDE8CA1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Dear all,

I have a data set , from a population based study, including 20,000
participants.

These 20,000 participants are nested in about 5,000 families.
All family members (living in the same house)  are included in the
study. I want to create a new variable, income per capita.

The data looks like that:

ID                Income (monthly)

9001             0,0000
9001             5,0000
9001             8,0000

9003             5,0000
9003             6,0000
9003             0,0000
9003             2,0000

The 9001 are member (3) of the same family, as well as the 9003 (4
members) and so on.

Thanks in advance, fernando

- --------------239F3F5331B035C3ECDE8CA1
Content-Type: text/x-vcard; charset=us-ascii;
 name="proietti.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Fernando Augusto Proietti
Content-Disposition: attachment;
 filename="proietti.vcf"

begin:vcard 
n:Proietti;Fernando 
tel;fax:55-31-3248-9675
tel;work:55-31-3248-9949 / 3248-9102
x-mozilla-html:FALSE
org:Dep de Medicina Preventiva e Social - UFMG
version:2.1
email;internet:[email protected] 
title:Professor Adjunto - Epidemiologia
adr;quoted-printable:;;Faculdade de Medicina - UFMG=0D=0AAv Prof
Alfredo Balena, 190;Belo Horizonte;Minas Gerais;30130-100;Brasil
x-mozilla-cpt:;17392
fn:Fernando  Proietti
end:vcard

- --------------239F3F5331B035C3ECDE8CA1--

*
*   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/ 

------------------------------

Date: Fri, 9 Dec 2005 15:27:20 +0100
From: "Maarten Buis" <[email protected]>
Subject: st: RE: How ?

Fernando:

Please use informative titles for your posts. 

Here is an example of how you could achieve what you want:

*----------------example-------------
sysuse auto, clear
sort rep78
by rep78: egen mean = mean(price)
list mean
*--------------end example----------------

HTH,
Maarten

- -----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/ 
- -----------------------------------------

- -----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Fernando
Augusto Proietti
Sent: vrijdag 9 december 2005 15:25
To: [email protected] 
Subject: st: How ?

Dear all,

I have a data set , from a population based study, including 20,000
participants.

These 20,000 participants are nested in about 5,000 families.
All family members (living in the same house)  are included in the
study. I want to create a new variable, income per capita.

The data looks like that:

ID                Income (monthly)

9001             0,0000
9001             5,0000
9001             8,0000

9003             5,0000
9003             6,0000
9003             0,0000
9003             2,0000

The 9001 are member (3) of the same family, as well as the 9003 (4
members) and so on.

Thanks in advance, fernando

*
*   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/ 

------------------------------

Date: Fri, 9 Dec 2005 14:41:53 -0000
From: "Roger Newson" <[email protected]>
Subject: st: New version of -rbn1mono- scheme on SSC

Hello All

Thanks to Kit Baum, a new version of the -rbn1mono- scheme is now
available
for download from SSC. In Stata, use the -ssc- command to do this,
typing

ssc desc scheme_rbn1mono

for a description, and

ssc install scheme_rbn1mono, replace

to install.

The -rbn1mono- package is described as below on my website. In the new
version, I have reshuffled the preferences amongst the shades of gray
to use
for shaded bars and areas, so -rbn1mono- now prefers white bars as
first
choice, then medium gray, then light gray, then dark gray. -rbn1mono-
is
therefore now a bit more minimal and photocopier-friendly than it was,
but
it is still a bit less minimal and photocopier-friendly than Svend
Juul's -lean- schemes.

Best wishes

Roger


-
----------------------------------------------------------------------------
package rbn1mono from http://www.kcl-phs.org.uk/rogernewson/stata9 
-
----------------------------------------------------------------------------

TITLE
      rbn1mono: A minimal monochrome graphics scheme

DESCRIPTION/AUTHOR(S)
      rbn1mono is Roger Newson's personal default scheme. It specifies
a
      minimal and photocopier-friendly black-and-white look, with gray
      background lines and minimal gray shading.  It is slightly more
      minimal and photocopier-friendly than s1mono (which is its
mother
      scheme), and slightly less minimal and photocopier-friendly than
      Svend Juul's lean schemes (which can be downloaded in their
latest
      form using the findit command).

      Author: Roger Newson
      Distribution-date: 08 December 2005
      Stata-version: 9


INSTALLATION FILES                                  (click here to
install)
      scheme-rbn1mono.scheme
      scheme_rbn1mono.hlp
-
----------------------------------------------------------------------------
(click here to return to the previous screen)

- --
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
Division of Asthma, Allergy and Lung Biology
King's College London

5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
  or 020 7848 6605 International +44 20 7848 6605
Email: [email protected] 
Website: http://phs.kcl.ac.uk/rogernewson/ 

Opinions expressed are those of the author, not the institution.




*
*   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/ 

------------------------------

Date: Fri, 9 Dec 2005 09:44:07 -0500
From: "David Roodman \([email protected]\)" <[email protected]>
Subject: st: new, memory-conserving xtabond2

The main comment I got on the new, Mata-based version of xtabond2 (see
http://www.stata.com/statalist/archive/2005-11/msg00717.html) is that
it
uses a lot of memory.

So I have just put up a new version that can operate in a space-saving
mode. Its behavior is controlled by the Mata system parameter
"matafavor". For example, typing the below at the *Stata* (not Mata)
prompt:
	mata: mata set matafavor speed
	xtabond2 ....
will run a command in speed-optimized mode.

Whereas:
	mata: mata set matafavor space
	xtabond2 ....
should use much less memory, at a modest cost in speed. (The
difference
is that in this mode, xtabond2 does not build the entire matrix of
"GMM-style" instruments, but only builds the rows for each individual
as
needed.)

See "help mata_set" for information about mainpulating the matafavor
parameter. Type "ssc install xtabond2, replace" to get the new
version.

All of this is relevant for Stata 9 only. Please let me know of any
problems.

- --David Roodman
Center for Global Development

*
*   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/ 

------------------------------

Date: Fri, 9 Dec 2005 10:06:21 -0500
From: "Kallimanis, Bellinda" <[email protected]>
Subject: st: Generating unique admission id

Hi Everyone, 

I have a data manipulation question. I have a large data set (panel
format) and I am trying to calculate length of stay for each
individual.
The thing is many individuals come in (adm asses) and stay then leave
(disch) then come back. But to complicate it more, some people leave
with anticipated return (dis_ret) then come back (reentry) and some
people are admitted and have follow up but have not been discharged.
What I would 

Dominic Muston
Cancer Screening Evaluation Unit
Institute of Cancer Research
Sutton, UK
Tel: +44 (0)20 7352 8133 x 4544
www.icr.ac.uk/cseu

*
*   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/



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