Calculating a mean per individual with multiple observations using data in long format

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Calculating a mean per individual with multiple observations using data in long format

Kathy McKnight
Hi all,

I have repeated physiological measures (every 2 seconds for about 18 seconds
per person) and I would like to get a mean reading for each individual, as
well as an estimate of the variance about that mean. The data are in long
format--each person is represented by a row of data for each of those 2
seconds, so that there are approximately 9 rows per person. How do I
calculate the mean and std deviation by person?

As a related issue, I thought at some point it would be useful to bootstrap
a mean from these data for each person, but when searching the help menu,
could only find bootstrapping procedures in CNLR as a subcommand or
bootstrapping with OMS. In my reading, it did not appear to me that either
of these applied to my needs, although I was a bit hazy on interpreting the
OMS documentation.

I'd appreciate advice on how to handle either or both of these data analyses
very much!

Thanks in advance for your time,

Kathy McKnight

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Calculating a mean per individual with multiple observations using data in long format

ViAnn Beadle
Look at the SUMMARIZE command.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Kathy McKnight
Sent: Thursday, June 26, 2008 12:35 PM
To: [hidden email]
Subject: Calculating a mean per individual with multiple observations using
data in long format

Hi all,

I have repeated physiological measures (every 2 seconds for about 18 seconds
per person) and I would like to get a mean reading for each individual, as
well as an estimate of the variance about that mean. The data are in long
format--each person is represented by a row of data for each of those 2
seconds, so that there are approximately 9 rows per person. How do I
calculate the mean and std deviation by person?

As a related issue, I thought at some point it would be useful to bootstrap
a mean from these data for each person, but when searching the help menu,
could only find bootstrapping procedures in CNLR as a subcommand or
bootstrapping with OMS. In my reading, it did not appear to me that either
of these applied to my needs, although I was a bit hazy on interpreting the
OMS documentation.

I'd appreciate advice on how to handle either or both of these data analyses
very much!

Thanks in advance for your time,

Kathy McKnight

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Calculating a mean per individual with multiple observations using data in long format

Maguin, Eugene
In reply to this post by Kathy McKnight
Kathy,

An easy way to draw a single bootstrap sample is the following. The trick is
to draw a randon number between 1 and the number of observations for that
person, which comes from the Aggregate comamnd, and then use that number as
the time point id variable to match back the original dataset that is
treated as a table file.

I'll assume your dataset looks like this

PersonId TimeId observation


Aggregate outfile=*/mode=addvariables/nobs=nu(caseid).

Rename variables (TimeId=tempid).

Compute TimeId=1+trunc(uniform(nobs)).

Sort cases personid timeid.

Match files file=*/table='original file name string'/by personid timeid.
Execute.


If you wanted to draw a 100 or a 1000 bootstrap samples, this really won't
work. Do you want to do this?

Gene Maguin

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD