FacDev Questionnaire Data Vis

アンケートのデータ表を視覚化した。 データ表の視覚化の図グラフ

データの表は: データ表

設問の表: FDアンケート設問表

解答の表 解答の表

DrRacketのスクリーンショット:この投稿のコードとデータで図グラフを作成した証拠 DrRacketのスクリーンショット

code

#lang racket

(define my-home (find-system-path 'home-dir))
(define learning-directory "Learning-Racket")
(define facdev-directory "FD")
;; ~/home-directory/Learning-Racket/FD"
(define data-file "DG-2018-1-Frequencies.csv")

(define Q-ja-file "SetsuMon.csv")

(define working-directory (build-path my-home learning-directory facdev-directory))
(current-directory-for-user working-directory)
(define data-path (build-path working-directory data-file))
(define get-data
  (lambda (pth)
    (let* ((inp (open-input-file pth))
	   (lines (port->lines inp)))
      (close-input-port inp)
      (map (lambda (s) (string-split
			(regexp-replace* "\"" s "")
				     ","))
	   lines))))

(define fd-data (get-data data-path))
(define info-data (list (first fd-data) (second fd-data)))
(define data-labels (cddr fd-data))
(define questions-ja (get-data (build-path working-directory Q-ja-file)))

(define (transpose-table tbl)
  (define (helper tbl dict) ; dictionary
    (cond
     ((empty? (first tbl)) (reverse dict))
     (#t (helper (map cdr tbl) (cons (cons (first (first tbl))
					   (map first (cdr tbl)))
				     dict)))))
  (helper tbl '()))

;; from info-lines generate plot-title and file-name
(define info-dict (transpose-table info-data))
(define (plot-title-join dict)
  (define (title-part entry)
    (string-join entry ":"))
  (map title-part dict))
(define plot-title-string
  (string-join (plot-title-join info-dict)
              ","))
(define (filename-join dict)
  (string-join
   (map car (dict-values dict))
   "-"))
(define plot-file-name
  (filename-join info-dict))
;;;;;;;;


(define (reorder-responses-ascending dat-labs) ;; data-labels
  (map (lambda (row) (cons (car row) (reverse (cdr row)))) dat-labs))

(define ascending-data-labels
  (reorder-responses-ascending data-labels))

(define (get-response-number row n)
  (string->number (list-ref row n)))

(define (sum-responses row n m)
  (+ (get-response-number  row n)(get-response-number row m)))

(define (positives-sum row)
  (sum-responses row 4 5))
(define (get-x-max dat-labs)
  (define max-pos-sum
    (positives-sum (argmax positives-sum dat-labs)))
  (* 1.08 max-pos-sum))
(define x-max (get-x-max ascending-data-labels))

(define (negatives-sum row)
  (sum-responses row 1 2))
(define (get-x-min dat-labs)
  (define max-neg-sum
    (negatives-sum (argmax negatives-sum dat-labs)))
  (- (* 1.08 max-neg-sum)))
(define x-min (get-x-min ascending-data-labels))

(require plot)
(require plot/utils)

;; (define neutral-response 3)
(define (neutral-line row y)
  (let* ((neutral-label (list-ref row 3))
         (neutral-number (string->number neutral-label))
	 (half (/ neutral-number 2)))
    (list 
     (hrule y (- half) half #:color "black")
     (point-label (vector 0 y) (string-append "3:" neutral-label)
                 #:anchor 'bottom #:point-size 5 #:size 9))))

(define (positive-line row y)
  (let* ((4-label (list-ref row 4))
         (4-number (string->number 4-label))
         (5-label (list-ref row 5))
         (5-number (string->number 5-label))
         (4n5 (+ 4-number 5-number)))
    (list

     (lines (list(vector 0 y) (vector 4-number y)) #:color "green")
     (lines (list (vector 4-number y) (vector 4n5 y)) #:color "green" #:width 3)
     (points (list (vector 4-number y)) #:color "black" #:sym 'fullcircle #:size 5)
     (point-label (vector 4n5 y) (string-append "4:" 4-label "," "5:" 5-label)
                 #:anchor 'bottom-right #:point-size 5))))

(define (negative-line row y)
  (let* ((1-label (list-ref row 1))
         (1-number (string->number 1-label))
         (2-label (list-ref row 2))
         (2-number (string->number 2-label))
         (1n2 (+ 1-number 2-number)))
    (list
     (point-label (vector (- 1n2) y) (string-append "1:" 1-label "," "2:" 2-label)
                 #:anchor 'bottom-left #:point-size 2)
     (lines (list (vector (- 1n2) y) (vector (- 2-number) y)) #:color "blue" #:width 3)
     (lines (list (vector (- 2-number) y) (vector 0 y)) #:color "blue")
     (points (list (vector (- 1n2) y)) #:color "black" #:sym 'fullcircle #:size 5)
     (points (list (vector 0 y)) #:color "black" #:sym 'fullcircle #:size 5)
     )))

(define (place-question key dict y)
  (let* ((d-ref (dict-ref dict key))
         (type (first d-ref))
         (question (second d-ref))
         (label (string-append type ":" question))
         (y-offset .3)
         (q-y (+ y y-offset)))positives-sum
    (point-label (vector 0 q-y) label #:point-size 0 #:size 14)))

(define (plot-a-question row dict y)
  (list
   (neutral-line row (- y .25))
   (positive-line row (- y .05))
   (negative-line row (- y .05))
   (place-question (first row) dict y)
   ))

(define (plot-questions data dict)
  (define (helper rows y plots)
    (cond
      ((empty? rows) plots)
      (#t (helper (cdr rows) (add1 y)
                 (cons (plot-a-question (car rows) dict y) plots)))))
  (helper data 1 '()))

(parameterize
    ((plot-title plot-title-string)
     (plot-x-axis? #f)
     (plot-x-label #f)
     (plot-x-far-axis? #f)
     (plot-y-axis? #f)
     (plot-y-label #f)
     (plot-y-far-axis? #f)
     (plot-width 1000)
     (plot-height 1000))
     (plot
      (plot-questions
       (sort (cdr ascending-data-labels) #:key positives-sum >)
       questions-ja)
      #;(plot-a-question (fourth ascending-data-labels) questions-ja 4)
    
      
	   #:x-min x-min #:x-max x-max
	   #:y-min 0 #:y-max 11.5
           #:out-file (string-append plot-file-name ".svg")
           #:out-kind 'svg))
  

data

DG-2018-1-Frequencies.csv

体,年,期,員,枚
大学,2018,1,59,2452
設問,5,4,3,2,1
出席,1738,472,206,23,8
発言,495,549,923,195,283
取組,713,765,736,162,65
聞取,1400,628,296,86,35
資料,1264,630,384,110,55
時刻,1795,446,166,25,13
反応,1378,654,317,59,38
熱意,1573,588,230,33,20
理解,976,886,438,99,42
役立,1411,684,289,33,24
満足,1217,740,388,58,38

SetsuMon.csv

出席,学生取組,私はこの授業によく出席した
発言,学生取組,私は授業内容について質問や発言した
取組,学生取組,私はこの科目に積極的に取り組んだ(予習と復習した)
聞取,教員実施,教員の声は聞き取りやすかった。
資料,教員実施,教員の板書(またはPPT・配布資料など)は読みやすかった(見やすかった)
時刻,教員実施,教員は授業の開始・終了の時刻を守ろうとしていた
反応,教員実施,教員は学生の反応を確かめながら授業を進めていた
熱意,教員実施,教員は熱意を持って授業をしていた
理解,総合評価,私はこの授業内容を理解できた
役立,総合評価,私はこの授業で学んだ内容はなんらかの形で将来的に役立つと感じた
満足,総合評価,私は総合的に判断してこの授業で満足が得られた

Motivation 動機

General Education and Democracy come to mind:

A striking and often overlooked finding in this work is the fact that the group of participants without technical training, “mostly ordinary housewives” as Cleveland describes them, performed just as well as the group of mostly men with substantial technical training and experience. This finding provides evidence for something that I’ve long suspected: that visualizations make it easier for people lacking quantitative experience to understand your results, serving to level the playing field. If you want your findings to be broadly accessible, it’s probably better to present a visualization rather than a bunch of numbers. It also suggests that if someone is having trouble interpreting your visualizations, it’s probably your fault. (Solomon Messing)

Getting information from a table is like extracting sunlight from a cucumber. (Farquhar & Farquhar, 1891) quoted by Howard Wainer

Order the rows and columns in a way that makes sense. We are almost never interested in “Austria First.” Two useful ways to order the data are... (Howard Wainer)

… pay no attention to a poll unless they know what questions were asked and why.. [free] themselves from the belief in the magical powers of numbers, do not regard calculation as an adequate substitute for judgement, or precision as a synonym for truth. (Neil Postman) どのような質問がされ、なぜそういう質問がされるかを知らないかぎり、世論調査に応じたり投票したりしない… 数字の魔力への信仰から開放されていて、計算を判断に代わりうるものにしたり、正確さを真実の同意語にしない…

#Racket #DrRacket #visualization #DataVisualization #HowardWainer #FD #FacDev #FacultyDevelopment #Anketo #Questionnaire