Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Reshaping long to wide data from complex experimental design


From   Bastien Christian <[email protected]>
To   [email protected]
Subject   Re: st: Reshaping long to wide data from complex experimental design
Date   Fri, 30 Nov 2012 17:25:07 +0100

I Nick,

Thanks for your advice.
I did look at the available help, but did non find an answer.

Here is an example of the data :
Groupe = Group (Réel, Augmenté) (between subject factor) (10 subjects per group)
Participant = participant id
Genre = Gender
Age
Phase (1 2) (within factor)
Distance = (8 15 23 28 33) (within factor)
Répétition : Repetition (1 2 3 4 5 6 7 8) (within factor)
Erreur_Absolue = Abs(distance error) the dependent variable

With this design, I get 800 recordings.
For each subject, we have 80 recordings.

Long Format:

Groupe	Participant	Genre	Age	Phase	Distance	Répétition	Erreur_Absolue
Réel	1	Femme	27	1	8	1	0.1
Réel	1	Femme	27	1	8	2	0.0
Réel	1	Femme	27	1	8	3	0.1
Réel	1	Femme	27	1	8	4	0.0
Réel	1	Femme	27	1	8	5	0.0
Réel	1	Femme	27	1	8	6	0.1
Réel	1	Femme	27	1	8	7	0.0
Réel	1	Femme	27	1	8	8	0.0
Réel	1	Femme	27	1	15	1	1.8
Réel	1	Femme	27	1	15	2	0.2
Réel	1	Femme	27	1	15	3	0.0
Réel	1	Femme	27	1	15	4	0.4
Réel	1	Femme	27	1	15	5	0.4
Réel	1	Femme	27	1	15	6	0.0
Réel	1	Femme	27	1	15	7	0.2
Réel	1	Femme	27	1	15	8	0.1
Réel	1	Femme	27	1	23	1	0.4
Réel	1	Femme	27	1	23	2	1.0
Réel	1	Femme	27	1	23	3	1.2
Réel	1	Femme	27	1	23	4	0.2
Réel	1	Femme	27	1	23	5	0.6
Réel	1	Femme	27	1	23	6	0.4

What I would like to have : 1 line per participant

Groupe, Participant, Genre, Age, Phase1Distance1Répétition1, …, Phase1Distance1Répétition8, Phase1Distance2Répétition1,…,Phase1Distance2Répétition8, …, Phase2Distance5Répétinion8

For the variables such as Phase1Distance1Répétition1 I would have 

As for the code, I just can't figure out the syntax. I tried to reshape with the dialogue box, but I always get an error message indicating that the Participant for example, is not unique within Groupe; there are multiple observations at the same Participant within Groupe.

Hope this will help,
Christian Bastien

Le 30 nov. 2012 à 16:32, Nick Cox <[email protected]> a écrit :

> It is better to give a concrete example of what your data look like
> and to show code you tried on which we can comment.
> 
> See http://www.stata.com/statalist/archive/2012-11/msg01106.html
> 
> for a recent example in which a similar question got nowhere because
> too few concrete details were given.
> 
> See also the help for -reshape-, the manual entry and
> 
> FAQ     . . . . . . . . . . . . . . . . . . . . . . . .  Problems with reshape
>        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
>        8/05    I am having problems with the reshape command. Can
>                you give further guidance?
>                http://www.stata.com/support/faqs/data-management/
>                problems-with-reshape/
> 
> 
> 
> Nick
> 
> On Fri, Nov 30, 2012 at 3:08 PM, Bastien Christian
> <[email protected]> wrote:
> 
>> In order to analyse data with MANOVA for repeated measures, I would like to reshape my data from a long to a wide format.
>> 
>> My design use 1 between factor (Group{2}) and 3 repeated factors (Trials(8), Distance(5), Phase(2)).
>> In fact the between factors allows the counterbalancing of the Phase Conditions.
>> 
>> Thus, each participant goes through 2 phases.
>> In each phase 5 target positions are used, and for each position there is 8 trials.
>> The task consists in positioning a virtual object as near as possible to the target. We measure the distance between the virtual object and the target.
>> 
>> I tried to use the "reshape" command but failed.
>> I just can't handle the syntax for 3 repeated measure.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index