Приложения канала
[Разметка Markdown] 

Faculty-Development: added-another-view

Negatives and Positives over Neutrals View

For questionnaires with an odd number of response choices, where the middle response is neutral/non-commital, it makes sense to separate out middle response. When disinterested, uninterested or just irritated with required questions I tend to go for the middle, neutral response. So, I like to see a direction to the negative and positive responses.

image

I play at this approach (among others) once a year or so, last year's attempt is displayed in WriteFreely posts. 1 The visualizations generated by universal passport this year, and by data-processing companies or office software in previous years, were not satisfactory, or even worthwhile. I haven't takens screenshots of the Universal Passport pdf yet but the previous years' visualization had inattentive scaling issues. 2

Inattentively Scaled Visualization

I shouldn't spend too much time on this, but working with racket and data visualization, thinking of view and then implementing it, is satisfying work. Writing racket code to view data is challenging and interesting. It's something you can keep getting better at, and eventually find an important way to use the skills. 3 Working with a data table about Minamata Disease and Minamata's declining fisheries industry made for an interesting conversation. The people at Soshisha 4 told me that years after most of the mercury had been buried, and new Minamata patients stopped being discovered, there was an article about 'Crab Boy' who came down with Minamata Disease. He loved crabs, went out to catch and eat a lot of them every day. I guess crabs have a high tolerance for methyl mercury, when other fish would die and go uneaten by people, those crabs just keep on carrying that industrial effluent into human brains.

Minamata Fishery Decline: See 1954 Crab increase

Code

Getting back on topic: below is the code to work with questionnaire data fit into a text-file convention. Japanese tends to pack more into each character making for shorter labels than English. I wanted to move the positives-negatives over neutrals view down a bit, to leave more of an impressions of the number of non-responders. It's possible to move the special view down with shorter Japanese labels, but the longer English labels tend to run off the page. There might be a way to avoid cut labels but plotting to picts and using 'panorama' but then their might be scaling issues when viewing different questions in one eyespan.

Japanese view

#! /usr/bin/env racket
#lang racket
;; From the Command line:
;; ; ./results-format-to-visualizations-2.rkt Q-results-format-ja.txt -ja
;; ; or default to Q-results-format.txt and cli arguments
;; ; Also > racket Anketo-result-format-to-visualizations.rkt
;; ;   if changing the mode to make the file executable is troublesome
;; ;;    > chmod + x  , or in emacs dired (C-x-d) M +x

(require csv-reading plot)

(define formatted-results
  (if (< 0 (vector-length (current-command-line-arguments)))
      (vector-ref (current-command-line-arguments) 0)
      "Q-results-format.txt"))

(define f-name-adjust
  (if (< 1 (vector-length (current-command-line-arguments)))
      (vector-ref (current-command-line-arguments) 1)
      ""))
(define (make-plot-filename str)
  (string-append str f-name-adjust))


(define text-string (file->string formatted-results))
;; text-string ; ok!
(define text-sections-list
  (string-split text-string "\n\n"))
;; text-sections-list ; ok!
(define responder-turnout-list (csv->list (first text-sections-list)))
;;  responder-turnout-list ; ok!

(define results-key-list (csv->list (second text-sections-list)))
;; results-key-list ;ok!
(define Q-results-list (map csv->list (drop text-sections-list 2)))
;; Q-results-list ; ok!

(define p-label-txt-size 16)
(define p-label-num-size 14)
(define line-width 10)

(define (regi-responded-lines-end-label x y num str )
  (list
   (point-label (vector x y) num
                #:anchor 'bottom-right #:point-size 0 #:size p-label-num-size)
   (point-label (vector x y) str
                #:anchor 'top-right #:color "black" #:point-size 0 #:size p-label-txt-size)))

(define (regi-responded-lines y num str (clr "light gray") (wdth line-width))
  (list (lines (list (vector 0 y)(vector num y)) #:color clr #:width wdth)
    (regi-responded-lines-end-label num y
                    (number->string num)
                    str)))

(define (label-question q-str)
  (point-label (vector 0 (+ 2 (length Q-results-list))) q-str
              #:anchor 'left #:point-size 0 #:size (+ 2 p-label-txt-size)))

(define (reponse-frequency-line result-num y response-string)
  (list
   (lines (list (vector 0 y)(vector result-num y))
          #:color "Cornflower Blue" #:width line-width)
   (point-label (vector result-num y)
                (string-append
                 (number->string result-num) " "
                 response-string)
                #:anchor 'left #:point-size 0 #:size p-label-num-size)))

(define (response-lines-w-qstn resp-list qstn-rslt-list)
  (define resp-txt-list (map second resp-list))
  (define q-str (second (first qstn-rslt-list)))
  (define rslts-freq-list (map string->number ;; frequencies
                         (rest (second qstn-rslt-list))))
  (define ys (range 3 (+ 3 (length resp-list))))
  (list
   (map reponse-frequency-line rslts-freq-list ys resp-txt-list)
   (label-question q-str)))

(define-values (soso-width very-width)
  (values (* .8 line-width)(* 1.2 line-width)))

(define (neutral-line mid-pnt y freq-3 (str "neutral") (clr "dark gray") (wdt line-width))
  (define leng-half (/ freq-3 2))
  (define x-start (- mid-pnt leng-half))
  (define x-end (+ mid-pnt leng-half))
  (list
   (lines (list (vector x-start y)(vector x-end y))
         #:color clr #:width wdt)
   (point-label (vector mid-pnt y) str #:point-size (- wdt 1) #:point-color "red"
               #:anchor 'top #:size 10)))

(define (negative-line freq-1 freq-2 mid-pnt (str-1 "one")(str-2 "two")(y 0) (clr "tomato"))
  (define freq2-start (- mid-pnt freq-2))
  (define freq1-start (- freq2-start freq-1))
  (list
   ;; somewhat negative line
   (lines (list (vector freq2-start y)(vector mid-pnt y))
         #:width soso-width #:color clr)
   ;; very negative line
   (lines (list (vector freq1-start y)(vector freq2-start y))
         #:width very-width #:color clr)
   ;; very label, write over lines when overlapping
   (point-label (vector freq1-start y) str-1 #:point-size 0
               #:anchor 'right #:size 10)
      ;; somewhat label, write over very label, same ending
   (point-label (vector freq2-start y) str-2 #:point-size 0
               #:anchor 'bottom #:size 10)
   (points (list (vector mid-pnt y)))))

(define (positive-line freq-4 freq-5 mid-pnt (str-4 "four")(str-5 "five")  (y 0) (clr "forest green"))
  (define freq4-end (+ mid-pnt freq-4))
  (define freq5-end (+ freq-5 freq4-end))
  (list
   ;; somewhat positive line
   (lines (list (vector mid-pnt y) (vector freq4-end y))
         #:width soso-width #:color clr)
   ;; very much line
   (lines (list (vector freq4-end y)(vector freq5-end y))
         #:width very-width #:color clr)
   ;; somewhat label, write over lines in case of overlap
   (point-label (vector freq4-end y) str-4 #:point-size 0
               #:anchor 'bottom)
   ;; ver label
   (point-label (vector freq5-end y) str-5 #:point-size 0
               #:anchor 'top-right)
   ))

(define (results->label q-results)
  (define rslts (rest (second q-results)))
  (define strgs (map second results-key-list))
  (map (lambda (r s) (string-append r "-" s))
      rslts strgs))

(define (plot-q-bitmap q-results) ; -bitmap remove bitmap for DrR testing
  (define f-name (path-add-extension
                  (make-plot-filename (first (first q-results)))
                  ".png"))
  (define-values (regsd-num regsd-str respd-num respd-str)
    (values (string->number (second (first responder-turnout-list)))
        (first (first responder-turnout-list))
        (string->number (second (second responder-turnout-list)))
        (first (second responder-turnout-list))))
  (define x-max-add (* .02 regsd-num))
  (define regsd-mid-pnt (/ regsd-num 2))
  (define respd-mid-pnt (/ respd-num 2)) ;; better feel for number of students that really responded one way or the other...
  (match-define (list frq5 frq4 frq3 frq2 frq1)
    (map string->number (rest (second q-results))))
  (match-define (list str5 str4 str3 str2 str1)
    (results->label q-results))

  (define pict-btmp ; -btmp ; -preview for DrR-testing of views
    (parameterize
        ((plot-decorations? #f)
         (plot-width 800)
         (plot-height 400)

         )
      (plot-bitmap ;-bitmap remove for testing in DrR with snips
       (list
    ;; box the data under the questions
        (vrule 0 0 (+ 2 (length Q-results-list)))
        (vrule (+ x-max-add regsd-num) 0 (+ 2 (length Q-results-list)))
        (hrule -2)
        ;; show registered line
    (regi-responded-lines 1 regsd-num regsd-str)
        ;; show reponded line
    (regi-responded-lines 2 respd-num respd-str "dark gray")
    ;; show frequencies line and Question text
        (response-lines-w-qstn results-key-list  q-results)
    ;; show negatives-positives over neutrals
        ;; ; neutrals line
        (neutral-line regsd-mid-pnt -.5 frq3 str3)
        ;; ; positives line
        (positive-line frq4 frq5 regsd-mid-pnt str4 str5 )
        ;; ; negatibes line
        (negative-line frq1 frq2 regsd-mid-pnt str1 str2)


        )
       #:x-min -1 #:x-max (+ regsd-num x-max-add)
       #:y-min -2.5 #:y-max (+ 3 (length Q-results-list)))))

   (send pict-btmp save-file f-name 'png)
 ;;  pict-preview

  );; end of plot-q-btmp

;; from DrR-3 testing
;; (plot-q (fifth Q-results-list))

(for-each plot-q-bitmap Q-results-list)

Data

English data is in a previous post with an earlier version of the code. 5

対象者,98
回答者,37

5,特にそう思う
4,そう思う
3,どちらともいえない
2,そうは思わない
1,全くそうは思わない

7,教員の授業中の声は聞き取りやすかったですか。
7,14,19,3,1,0

8,"授業中のスライド、配布資料、板書等は読みやすかったですか。"
8,10,24,2,1,0

9,教員は学生の反応を確かめながら授業を進めていましたか。
9,18,15,4,0,0

10,教員は熱意をもって授業をしていましたか。
10,23,14,0,0,0

11,"教員は授業の開始・終了を守ろうとしていましたか"
11,17,19,1,0,0

12,"教員から予習、復習課題(レポート課題を含む)の提示はありましたか。"
12,19,17,1,0,0



    • https://write.as/bs2facdev/questionnaire-processing-with-racket
    • https://write.as/bs2facdev/questionnaire-visualization

    ↩︎

    • https://snap.as/bsmall2/fd-racket
    • https://snap.as/bsmall2/fd-racket/YIu5dO2

    ↩︎

    • https://write.as/bs2lr/minamata-fish-market-decline-1950-1956
    • https://write.as/bs2lr/shui-yu-yu-ye-jian-shou-1950-1956

    ↩︎

    • https://www.minamatadiseasemuseum.net/
    • https://www.soshisha.org/jp/

    ↩︎

    • https://tiksi.net/wiki/bsmall2/Faculty-Development/Home
    • I'll have to rename the page to first-view later and use Home as an index page.

    ↩︎