;; Function taks a SRS from the 1052 schools and runs Terrace-Two. ;; (load "ter2") (load "nels") ;;(def row-ind (list 547 375 323 719 432 367 261 63 400 201 155 898 993 396 ;;856 600 1041 524 686 616)) (defun sample-schools (n) (let* ((r (array-dimension schl-data 0)) (row-ind (sample (iseq r) n)) (col-ind (cons 0 (1+ (car (choose-subset-dialog "School Variables" (cdr schl-labels)))))) (stud-ind (cons 0 (1+ (car (choose-subset-dialog "Student Variables, last var is dependent" (cdr stud-labels))))))) (print row-ind) (make-terrace (select schl-data row-ind col-ind) (select stud-data (iseq (array-dimension stud-data 0)) stud-ind) :x-labels (select stud-labels (select stud-ind (iseq (- (length stud-ind) 1)))) :z-labels (select schl-labels col-ind)))) ;;; to keep a particular group of schools we must save the variable ;;; row-ind and use the altered function below (defun sample-schools (n row-ind) (let* ((r (array-dimension schl-data 0)) (row-ind row-ind) (col-ind (cons 0 (1+ (car (choose-subset-dialog "School Variables" (cdr schl-labels)))))) (stud-ind (cons 0 (1+ (car (choose-subset-dialog "Student Variables, last var is dependent" (cdr stud-labels))))))) (print row-ind) (make-terrace (select schl-data row-ind col-ind) (select stud-data (iseq (array-dimension stud-data 0)) stud-ind) :x-labels (select stud-labels (select stud-ind (iseq (- (length stud-ind) 1)))) :z-labels (select schl-labels col-ind)))) ;;(setf ter1 (make-terrace school-data student-data ;:x-labels x-labels ;:z-labels z-labels)) ;;(def studs-schl-id (select stud-data (iseq (array-dimension stud-data 0)) 0)) ;;(def studs-schl-id (combine studs-schl-id)) ;;this defines "col" as the first column of the stud-data matrix, which ;;is the student id. ;;(setf studs (which (= 91991 studs-schl-id))) ;;this finds the indices of the students with the school-id of interest, e.g., ;;say the school with school-id 91991. ;;(def studs-91991 (select stud-data studs-91991 ;; (iseq (array-dimension stud-data 1))) ;;This constructs the complete student data matrix for the given school. ;;Might want to repeatedly sample schools, and examine the distribution of ;;certain things, e.g., the number of public schools selected, or at ;;another level, the total number of Asian students selected in the ;;sample.