(defun nai_boo1 (inputdata weight_lst) "Args: inputdata num_resam Naive bootstrap: inputdata is a list of data which has been stratified, num_resam is the number of resample size. Returns a list of data which is resampled from the original list, the number of observations in eac h stratum is proportional to the original stratum size." ; The following program computes the stratum size for the resample. (setf l (length inputdata)) (setf len_lst (repeat 0 l)) (setf len_lst1 (repeat 0 l)) (dotimes (i l) (setf (nth i len_lst) (length (nth i inputdata))) ) (setf total(sum len_lst)) (def num_resam(first (get-value-dialog "Resample size:" :initial total))) (dotimes (i l) (setf (nth i len_lst1) (round (* (/ (nth i len_lst) total) num_resam))) ) ; The following program gives a list of resample. (setf resam nil) (setf mean_lst(repeat 0 l)) (dotimes (i l) (setf x(sample (nth i inputdata) (nth i len_lst1) t)) (setf resam(append resam (list (copy-list x)))) (setf (nth i mean_lst) (mean x)) ) ; weight (setf mean_star(sum (* weight_lst mean_lst))) (defun get-reg-type () (let* ( (label (send text-item-proto :new "Enter the Function of Interest:")) (butt-1 (send button-item-proto :new "A Xlispstat Command" :action #'(lambda () (slider-dialog-1)))) (butt-2 (send button-item-proto :new "A Filename of Which Contains the Function:" :action #'(lambda () (slider-dialog-2)))) ) (send dialog-proto :new (list butt-1 butt-2)) ) ) (defun slider-dialog-1 () (let* ( (choice-1 (send text-item-proto :new "Command:")) (k1 (send edit-text-item-proto :new "" :text-length 30)) (ok (send modal-button-proto :new "OK" :action #'(lambda () (setf result1 (list (send k1 :text))))) (pick-dialog (send modal-dialog-proto :new (list choice-1 k1 ok))) ) (send pick-dialog :modal-dialog) ) ) (defun slider-dialog-2 () (let* ( (choice-2 (get-string-dialog "Filename:")) (choice-3 (send text-item-proto :new "Function name in the file:")) (k2 (send edit-text-item-proto :new "" :text-length 30)) (ok (send modal-button-proto :new "OK" :action #'(lambda () (setf result1 (list (send choice-2 :text) (send k2 :text))))) (pick-dialog (send modal-dialog-proto :new (list choice-2 choice-3 k2 ok))) ) (send pick-dialog :modal-dialog) ) ) (def col-fun(get-reg-type)) (setf filename (first col-fun)) (if (= (second col-fun) 1) (load filename)) (setf theta(filename mean_star)) (setf variance_est(^ (standard-deviation theta) 2)) )