Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bootstrap resampling techniques

Status
Not open for further replies.

fcolassie

Technical User
Dec 12, 2003
12
NL
Hi all,

Does anybody have any experience with writing awk scripts to perform bootstrap or jackknife procedures.

Input will be appreciated.

Thanks in advance

 
I found the following at -


I hope it will at least be a step in the direction you are attempting to go.


The following awk script may help you to create the data files. If you embed a call to awk followed by a call to invoke nonmem and loop over the records in your id data file you should be able complete your bootstrap.

I have only tested it in a limited fashion. Let me know if you need a copy of awk (for DOS). It is small (47k) and public domain.

#boot
# assume each set of IDs are in a record in a file called id.dat delimited with
# spaces e.g.
# 25 18 7 11 33 ...
# 8 10 17 1 22 ...
# assume original NONMEM input data file with ID in col 1 called nm.dat
#
# select record from id.dat to use by setting IDROW= to record number
#Usage:
# awk -f boot.awk -v DATA=nm.dat -v IDROW=1 id.dat
BEGIN {
IDCOL=1 # col number for ID in nm.dat
DELIM=" " # field delimiter in nm.dat
n=0 # counter to name each new NONMEM output file
}
NR==IDROW {
NMOUT="nmsamp.dat"
print "# IDs="$0 > NMOUT
ok=getline datrec < DATA
do {
split(datrec,data,DELIM)
id=data[IDCOL]
for ( i=1; i <= NF ; i++ ) {
if ( id == $i ) {
do {
print datrec >> NMOUT
ok=getline datrec < DATA
split(datrec,data,DELIM)
id=data[IDCOL]
} while ( id == $i && ok > 0 )
i = NF*2 # force exit from for loop
}
}
if ( i == NF+1 ) ok=getline datrec < DATA
} while ( ok > 0 )
close(DATA)
close(NMOUT)
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top