Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: RE: Re: sum across observations until a certain cutpoint


From   Steven Samuels <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: Re: sum across observations until a certain cutpoint
Date   Sun, 9 Nov 2008 14:31:04 -0500

-reshape- is a Stata command


On Nov 9, 2008, at 1:20 PM, Amanda Botticello wrote:

I want to calculate how many items each subject completed within 60 seconds. And I can't do anything about the data structure, unfortunately.


Amanda L. Botticello, PhD, MPH
Outcomes Research Scientist
Kessler Medical Rehabilitation Research and Education Center
Assistant Professor
Department of Physical Medicine & Rehabilitation
UMDNJ-New Jersey Medical School

1199 Pleasant Valley Way
West Orange, NJ  07052
phone: (973)243-6973
email: [email protected]


"Nick Cox" <[email protected]> 11/9/2008 1:14 PM >>>
You've lost me. I don't understand how your data structure copes with
time spent on failed tasks.

Please be clear: Do you want to cumulate times and see how many tasks in
total were completed within a total of 60 seconds, as implied by your
original question, or do you just want to count how many tasks were
individually completed within 60 seconds?

Incidentally, I think you would be better off reshaping this to long.

Nick
[email protected]

Amanda Botticello

The data is more like this:

id  item1  time1    item2  time2  itmem3 time3
1    1         2           1         3        1          2
2    1         5           0         0        0          0
3    1         3           1         3        1          5

The variable "item" is coded 0,1, where 1 indicates the item was
completed
Time is recorded in number of seconds to complete.  If they didn't
complete an item, the time is 0

"Nick Cox" <[email protected]> 11/9/2008 12:59 PM >>>
Still not very clear to me, but I guess something like this

task1 task2 task3  task4  task5
20      10    20    5       10
5       10    15    30      2
100     2      3    3       4

So that the three individuals above had completed 4, 4, 0 tasks in the
first 60 seconds.

How many within 60 seconds?

gen cumul = 0
gen within60 = 0

qui forval i = 1/5 {
	replace cumul = cumul + task`i'
	replace within60 = `i' if cumul <= 60
}

Nick
[email protected]

Amanda Botticello PhD, MPH

IT's a "wide" dataset...subjects completed up to 200 items in a task,
and we recorded the number of seconds it took to complete each item. I can create a sum of the total number of items completed and total time;
now I want to find out how many items each individual completed in 60,
90, and 120 seconds.  Does that help?

"Martin Weiss" <[email protected]> 11/9/2008 11:00 AM >>>

Well, if you want the running sum, look at -help sum()-. But maybe you
could
give us a peek at your data structure, that would assist in answering
your
question...

"Amanda Botticello" <[email protected]>

I have a dataset of test items and the time (in seconds)to complete
each
item. I need to create a variable that sums the time variables up to a

certain number -- i.e., 60, 90, 120 seconds. Is there a way I can use
the
egen newvar = rowtot (time*) command to count up to 60 seconds, etc?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


The information in this transmission is intended for official use of the Kessler Foundation. It is intended for the exclusive use of the persons or entities to which it is addressed. If you are not an intended recipient or the employee or agent responsible for delivering this transmission to an intended recipient, be aware that any disclosure, dissemination, distribution or copying of this communication, or the use of its contents, is strictly prohibited. If you received this transmission in error, please notify the sender by return e-mail and delete the material from any computer.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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