Data cleanup with 5% trimmed mean

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

Data cleanup with 5% trimmed mean

Brian Moore-3
Hi all-

How can I include the 5% trimmed mean (accessible in the GUI thru -->explore
commend as a standard statistic) of a variable (V1) as a new variable split
by another (V2).  I'm using V15, but without python programmability
installed.

Thanks,
Brian

Data list list /v1 (f8.0)  v2 (f8.0).
Begin Data
55      1
88      1
75      1
67      1
89      1
96      1
71      1
23      1
93      1
81      1
35      1
82      1
2       1
40      1
56      1
9       1
34      1
4       1
53      1
65      1
68      1
38      1
79      1
88      1
5       1
39      1
50      1
650     2
675     2
888     2
100000  2
500     2
999     2
2459    2
8269    2
5601    2
369     2
2175    2
1892    2
1872    2
4686    2
7239    2
9709    2
5419    2
1678    2
8696    2
2431    2
1486    2
8533    2
2182    2
6858    2
8727    2
5536    2
End Data.
Reply | Threaded
Open this post in threaded view
|

Re: Data cleanup with 5% trimmed mean

Marta García-Granero
Hi Brian:

Use OMS to save to a file the statistics table, open it, eliminate the
unwanted statistics and match this reduced file to the first one.

Regards,
Marta

BM> How can I include the 5% trimmed mean (accessible in the GUI thru -->explore
BM> commend as a standard statistic) of a variable (V1) as a new variable split
BM> by another (V2).  I'm using V15, but without python programmability
BM> installed.

BM> Thanks,
BM> Brian

BM> Data list list /v1 (f8.0)  v2 (f8.0).
BM> Begin Data
BM> 55      1
BM> 88      1
BM> 75      1
BM> 67      1
BM> 89      1
BM> 96      1
BM> 71      1
BM> 23      1
BM> 93      1
BM> 81      1
BM> 35      1
BM> 82      1
BM> 2       1
BM> 40      1
BM> 56      1
BM> 9       1
BM> 34      1
BM> 4       1
BM> 53      1
BM> 65      1
BM> 68      1
BM> 38      1
BM> 79      1
BM> 88      1
BM> 5       1
BM> 39      1
BM> 50      1
BM> 650     2
BM> 675     2
BM> 888     2
BM> 100000  2
BM> 500     2
BM> 999     2
BM> 2459    2
BM> 8269    2
BM> 5601    2
BM> 369     2
BM> 2175    2
BM> 1892    2
BM> 1872    2
BM> 4686    2
BM> 7239    2
BM> 9709    2
BM> 5419    2
BM> 1678    2
BM> 8696    2
BM> 2431    2
BM> 1486    2
BM> 8533    2
BM> 2182    2
BM> 6858    2
BM> 8727    2
BM> 5536    2
BM> End Data.
Reply | Threaded
Open this post in threaded view
|

Re: Data cleanup with 5% trimmed mean

Beadle, ViAnn
In reply to this post by Brian Moore-3
Did you try split file, splitting on v2?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Brian Moore
Sent: Wednesday, February 21, 2007 1:31 PM
To: [hidden email]
Subject: Data cleanup with 5% trimmed mean

Hi all-

How can I include the 5% trimmed mean (accessible in the GUI thru -->explore
commend as a standard statistic) of a variable (V1) as a new variable split
by another (V2).  I'm using V15, but without python programmability
installed.

Thanks,
Brian

Data list list /v1 (f8.0)  v2 (f8.0).
Begin Data
55      1
88      1
75      1
67      1
89      1
96      1
71      1
23      1
93      1
81      1
35      1
82      1
2       1
40      1
56      1
9       1
34      1
4       1
53      1
65      1
68      1
38      1
79      1
88      1
5       1
39      1
50      1
650     2
675     2
888     2
100000  2
500     2
999     2
2459    2
8269    2
5601    2
369     2
2175    2
1892    2
1872    2
4686    2
7239    2
9709    2
5419    2
1678    2
8696    2
2431    2
1486    2
8533    2
2182    2
6858    2
8727    2
5536    2
End Data.
Reply | Threaded
Open this post in threaded view
|

Re: Data cleanup with 5% trimmed mean

Marta García-Granero
In reply to this post by Brian Moore-3
Hi Brian

This is a complete answer to your question:

* Your dataset *.
DATA LIST FREE /v1(F8) v2(F8).
BEGIN DATA
55 1 88 1 75 1 67 1 89 1 96 1 71 1 23 1 93 1 81 1
35 1 82 1 2 1 40 1 56 1 9 1 34 1 4 1 53 1 65 1 68 1
38 1 79 1 88 1 5 1 39 1 50 1 650 2 675 2  888 2 100000 2
500 2 999 2 2459 2 8269 2 5601 2 369 2 2175 2 1892 2
1872 2 4686 2 7239 2 9709 2 5419 2 1678 2 8696 2 2431 2
1486 2 8533 2 2182 2 6858 2 8727 2 5536 2
END DATA.
DATASET NAME OriginalFile.

* Modify some options to make working with output easier *.
PRESERVE.
SET OLANG=ENGLISH.
SET OVars Labels ONumbers Labels TVars Labels TNumbers Both.

* OMS.
DATASET DECLARE Descriptives.
OMS
 /SELECT TABLES
 /IF COMMANDS = ["Explore"]
 SUBTYPES = ["Descriptives"]
 /DESTINATION FORMAT = SAV
 OUTFILE = Descriptives.

EXAMINE
 VARIABLES=v1 BY v2
 /PLOT NONE
 /COMPARE GROUP
 /STATISTICS DESCRIPTIVES
 /NOTOTAL.
OMSEND.

* Set the options back to original values *.
RESTORE.

* Clean output file and prepare it for matching *.
DATASET ACTIVATE Descriptives.
SELECT IF Var3='5% Trimmed Mean'.
NUMERIC v2 (F8).
COMPUTE v2 = NUMBER(SUBSTR(Var2,1,1),F8) .
EXECUTE .
RENAME VARIABLES (Statistic = TrimmedMean).
DELETE VARIABLES Command_ TO Label_ Var1 TO Var4 Std.Error .
SORT CASES BY v2(A).

* Match TrimmedMean to OriginalFile *.
DATASET ACTIVATE OriginalFile.
SORT CASES BY v2(A).
MATCH FILES /FILE=*
 /TABLE='Descriptives'
 /BY v2.
EXECUTE.

--
Regards,
Dr. Marta García-Granero,PhD           mailto:[hidden email]
Statistician

---
"It is unwise to use a statistical procedure whose use one does
not understand. SPSS syntax guide cannot supply this knowledge, and it
is certainly no substitute for the basic understanding of statistics
and statistical thinking that is essential for the wise choice of
methods and the correct interpretation of their results".

(Adapted from WinPepi manual - I'm sure Joe Abrahmson will not mind)

*********************************************************************************

Wednesday, February 21, 2007, 8:31:27 PM, You wrote:

BM> How can I include the 5% trimmed mean (accessible in the GUI thru -->explore
BM> commend as a standard statistic) of a variable (V1) as a new variable split
BM> by another (V2).  I'm using V15, but without python programmability
BM> installed.

BM> Data list list /v1 (f8.0)  v2 (f8.0).
BM> Begin Data
BM> 55      1
BM> 88      1
BM> 75      1
BM> 67      1
BM> 89      1
BM> 96      1
BM> 71      1
BM> 23      1
BM> 93      1
BM> 81      1
BM> 35      1
BM> 82      1
BM> 2       1
BM> 40      1
BM> 56      1
BM> 9       1
BM> 34      1
BM> 4       1
BM> 53      1
BM> 65      1
BM> 68      1
BM> 38      1
BM> 79      1
BM> 88      1
BM> 5       1
BM> 39      1
BM> 50      1
BM> 650     2
BM> 675     2
BM> 888     2
BM> 100000  2
BM> 500     2
BM> 999     2
BM> 2459    2
BM> 8269    2
BM> 5601    2
BM> 369     2
BM> 2175    2
BM> 1892    2
BM> 1872    2
BM> 4686    2
BM> 7239    2
BM> 9709    2
BM> 5419    2
BM> 1678    2
BM> 8696    2
BM> 2431    2
BM> 1486    2
BM> 8533    2
BM> 2182    2
BM> 6858    2
BM> 8727    2
BM> 5536    2
BM> End Data.