M-estimators as new variables?

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

M-estimators as new variables?

Joerg H.
Is there, in newer SPSS Versions, any way to compute the robust m-estimators like Huber , Tukey,
Hampel and Andrew into new variables in the SPSS Datafile?
I just don´t want to paste hundreds of numbers from the .xls exported output into the data file.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: M-estimators as new variables?

Marta García-Granero
Hi Joerg

JH> Is there, in newer SPSS Versions, any way to compute the
JH> robust m-estimators like Huber , Tukey,
JH> Hampel and Andrew into new variables in the SPSS Datafile?
JH> I just don´t want to paste hundreds of numbers from the .xls
JH> exported output into the data file.

You can use OMS to export them to a SPSS sav file and match them later
with your dataset. The following code was written in SPSS 13, if you
have a newer version (with the capability of handling multiple
datasets, then you can skip some SAVE OUTFILE and GET FILE commands:

* Sample dataset (replace by your own data) *.
DATA LIST FREE/ diet wgtgain (2 F5).
BEGIN DATA
1 123 1 132 1 149 1 151 1 175 1 179 1 187
1 200 1 206 1 206 1 218 1 219 1 234 1 248
2 142 2 176 2 195 2 199 2 211 2 214 2 216
2 236 2 249 2 253 2 262 2 302 2 311 2 337
END DATA.
VAR LABEL diet 'Diet group' / wgtgain 'Weight increase (pounds)'.
VALUE LABEL diet 1 'Standard' 2 'A Vitamin'.
VAR LEVEL diet (NOMINAL).
SAVE OUTFILE='C:\Temp\OriginalFile.sav'.

OMS
 /SELECT TABLES
 /IF COMMANDS = ["Explore"]
     SUBTYPES = ["M Estimators"]
 /DESTINATION FORMAT = SAV
  OUTFILE = "C:\Temp\REstimators.sav".
EXAMINE
  VARIABLES=wgtgain BY diet
  /PLOT BOXPLOT STEMLEAF
  /MESTIMATORS  HUBER(1.339) ANDREW(1.34) HAMPEL(1.7,3.4,8.5) TUKEY(4.685)
  /STATISTICS DESCRIPTIVES
  /CINTERVAL 95
  /NOTOTAL.
OMSEND.

* Cleaning the dataset and recoding categorical values for matching *.
GET FILE='C:\Temp\REstimators.sav'
 /DROP=Command_ TO Var1.
RECODE Var2 ('Standard'=1)  ('A Vitamin'=2)  INTO  diet .
SAVE OUTFILE='C:\Temp\REstimators.sav' /DROP=Var2.

* Get the original file and match with the cleaned dataset *.
GET FILE='C:\Temp\OriginalFile.sav'.
MATCH FILES /FILE=*
 /TABLE='C:\temp\REstimators.sav'
 /BY diet.

LIST.


--
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)
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

Judith Saebel
Hi John,

If you give each of the 20 records a case number, why don't you simply
draw a random sample of 10 from among the 20 cases, using the command
below:

Sample 10 from 20.

(See p. 1545 of the SPSS Manual".)


Then treat one group as treatment and the other as control.


Here's a fictitious example of what the command does:

Data list free/casenum (f2).

Begin data
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
end data.

Sample 10 from 20.

list casenum.

Output:

casenum

    1
    2
    4
    5
    7
    9
   10
   11
   12
   18

Regards,

Judith