Date: Thu, 28 Apr 2005 12:49:53 -0500
Reply-To: "Peck, Jon" <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Peck, Jon" <email@example.com>
Subject: Re: random item modification/gene/jim/art
Content-Type: text/plain; charset="US-ASCII"
Use the Data/Select Cases/random sample of cases
dialog box. Specify the exact m of n choice, and paste the resulting syntax, and you will see how to make this exact.
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Handel, Richard W.
Sent: Thursday, April 28, 2005 11:23 AM
Subject: Re: [SPSSX-L] random item modification/gene/jim/art
Thanks to Gene, Jim, and Art for your replies! One other question: Is there a way to do this if I had to have *exactly* 10% of the items modified (i.e., exactly 20 items out of 200 for each case)? Your replies are greatly appreciated.
Richard W. Handel, Ph.D.
Assistant Professor/Licensed Clinical Psychologist
Eastern Virginia Medical School
Department of Psychiatry and Behavioral Sciences
Hofheimer Hall, 825 Fairfax Avenue
Norfolk, VA 23507
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Sent: Thursday, April 28, 2005 11:17 AM
Subject: Re: random item modification
If you want to change about 10% of the items for each case the approach
used in the tested demo syntax below my sig block should do it.
In this approach each item has a 10% chance of being forced to true.
For purposes of debugging and demonstration note that I have used 3 as
the new value.
Also note that with today's date as the seed each the 3 cases in the
demo came up with 1, 0, and 3 changes.
If you want to have exactly 10% changed, this syntax would not work.
Save all your current work, then open a new instance of SPSS. Make sure
that you put warnings, etc. into the output file. <edit> <options>
<viewer>. Cut-and-paste then run the syntax at the end of this message.
Hope this helps.
Social Research Consultants
University Park, MD USA
* this program creates 10 "true/false" variables .
set seed = 20050427.
vector item (10,f1).
loop id = 1 to 3.
loop #k = 1 to 10.
compute item(#k) = rv.bernoulli(.7).
end input program.
formats id (f3).
*you would adapt by putting something like.
*vector items= item001 to item200.
*since this is a simulation, overwriting a variable is not as dangerous
*as it it usually would be. Be sure not to save over the original input
*with a SAVE or XSAVE .
*I have used 3 as the new value so you can see where there is a change.
*you could either use 1 once you test the syntax or score with
*count score2 = newitem001 to item200 (1,3).
do repeat item = item1 to item10
/newitem = newitem01 to newitem10.
do if rv.bernoulli(.1) eq 1.
compute newitem = 3.
compute newitem = item.
formats newitem01 to newitem10 (f1).
Handel, Richard W. wrote:
>I have a set of psychological inventory responses that I'd like to modify for the purposes of a research study (the details are probably not relevant). In the past, I've done this procedure on a case by case basis, but I'm guessing that there is probably a much easier way to accomplish my goals and I'm working with a much larger data set now that would make case by case modification very time consuming. Here's a hypothetical statement of the problem (specific n's, etc., are not exactly what I'll be using).
>1) Suppose I have 400 cases of test inventory "true false" reponses on a 200-item inventory. Therefore, I have variables listed as i1 to i200, and each variable contains either a "1" for true or a "2" for false.
>2) I'd like to randomly select 10% of the items and replace the original values with "all trues" (i.e., all 1 reponses). The remaining 90% of the items need to remain unchanged.
>3) Here's the tricky part: This must be done on a case by case basis. For example, for case 1, 10% of the items would be randomly selected and replaced with 1's. For case 2, a *different set* of 10% (i.e., an entirely new random selection of 10% of the items for case 2) would be selected and replaced with 1's. For case 3, a similar procedure (i.e., a new random selection of 10%) would be followed.
>Is there a relatively easy to do this? When I was working with small data sets, I just used the flip command and modified individual cases, but now my data set is much larger.
>Richard W. Handel, Ph.D.
>Assistant Professor/Licensed Clinical Psychologist
>Eastern Virginia Medical School
>Department of Psychiatry and Behavioral Sciences
>Hofheimer Hall, 825 Fairfax Avenue
>Norfolk, VA 23507