Как я узнаю, что вероятность появления Y зависит от X1 и X2 в Netlo go? Y, X1 и X2 - переменные черепахи - PullRequest
0 голосов
/ 11 апреля 2020

У меня есть конкретно два вопроса:

  1. Как я узнаю, что вероятность лидерской активности зависит как от лидерактивации, так и от восприятия окружающих.
  2. Как мне узнать, что вероятность лидерства зависит от мотивации (состояние мотивации> 3,32), самосхемы (selfschemata> 7) и нети (социальные факторы, нети> 0) в конкретное время.

'' '

    globals [taskdemand ;; the taskdemand of the turtles
  percent-LA;
  percent-LP;
  percent-LI;
  probLA;
  probLP;
  probLI;
  err;;
;percent-LIr
;percent-aLAnLp
;percent-nLALp
;percent-LALP
;percent-nLAnLP
]



turtles-own [
  motivation ;;motivation to lead of each turtle
  selfschemata ;; self-schemata of each turtle
  status  ;;status of each turtle
  others;;agentset of  agents within same group
  ;;teammates;; agentset of teammates
  othersactivation;; othersactivation computes leaderactivation of each turtle within the group of turtle
  allothers;;agentset of all other agents within the collective
  neti;;neti computes socialfactors and taskdemand of each turtle
  x;;x is prospective leader's perceived characteristics
  y;;y is perceivers ILT for various dimensions
  othersperception ;; leadershipperception of all other turtles in collective level
  leaderactivation;;leader self-schema activation
  leadershipperception;; leadershipperception of each turtle in relational level
  leadershipactivation;; leadershipactivation in a collective level
 leadershipactivationr;;
  mygroup;; group of turtles
  LA?;;
  aLA?;;
  aLP?;;
  aLi?;;
 aLir?
aLAnLp?
nLALp?
LALP?
nLAnLP?
]

to setup
  clear-all; clears ticks, patches, plots
  ask patches[ set pcolor white];;blank background
  crt 100 [

    setxy random-xcor random-ycor
    set shape "person"
    set motivation random-normal 3.32 0.75;;motivation to lead is normally distributed with mean 3.32 and standard deviation 0.75
    set selfschemata (random  11) + 1 ;;sets selfschemata 1 to 11
    set status random-normal 4 0.49 ;;status is normally distributed with mean 4 and standard deviation 0.49
    set leaderactivation random 1 ;;sets leaderactivation values 0  to each turtle (self-schema activation, individual level)
    set leadershipperception random 1 ;; sets leadershipperception values 0 to each turtle (relational level)
    set neti random 1 ;;sets neti values 0  to each turtle, neti calculates the social factors
    set othersactivation random 1 ;;sets each turtles, othersactivation (i.e., leaderactivation) value in a group  to 0
    set othersperception random 1;;sets othersperception values 0 to each turtle
    set leadershipactivation random 1;; sets leadershipactivation values 0 to each turtle (collective level)
    set leadershipactivationr random 1;;
    set others no-turtles
    set allothers no-turtles
    if ( status > 4) OR (status = 4)[set color blue]
    if ( status < 4)[set color red]
    set x n-values 5 [random 1];; setting random values 0 or 1 for 5 dimensions of prospective leader's perceived characteristics
    set y n-values 5[random 1];;perceiver's ILT for various dimensions
    set mygroup -1
    ]
    assign-by-size
    set taskdemand [0.1 0.9]
    set err random-normal 0 0.01;;setting error with mean 0 and standard deviation 0.01
 reset-ticks
end

to assign-by-size
   let unassigned turtles
   let current 0
  while [any? unassigned]
  [
    ;; place a randomly chosen set of group-size turtles into the current
    ;; group. or, if there are less than group-size turtles left, place the
    ;; rest of the turtles in the current group.
    ask n-of (min (list group-size (count unassigned))) unassigned
      [ set mygroup current ]
    ;; consider the next group.
    set current current + 1
    ;; remove grouped turtles from the pool of turtles to assign
    set unassigned unassigned with [mygroup = -1]
  ]
end

to go
   if ticks >= 300 [ stop ]
   ask turtles [
    if (mygroup != -1) [leader-activation] ;; individual level
    if (mygroup != -1) [ checksocialfactors] ;; individual level
    if (leaderactivation > 2) OR (leaderactivation = 2) [ set x n-values 5 [random 2]]
  if (mygroup != -1) [ ilt-match];;relational level
  ifelse (leaderactivation > 2) OR (leaderactivation = 2)[ set leadershipperception leadershipperception ][set leadershipperception 0]
  if (mygroup != -1) [set leadershipactivationr  leadershipperception + leaderactivation]
  if (mygroup != -1) [collectivelevel];;collective level
  if (mygroup != -1)[set leadershipactivation othersperception + leaderactivation]
  ]
  update-variables
  tick
  end


to leader-activation  ;; leader activation at the individual level

  ifelse (motivation > 3.32) OR (motivation = 3.32) [set leaderactivation leaderactivation + 1 ][set leaderactivation leaderactivation + 0]
  if (selfschemata > 0) AND (selfschemata < 5)[set leaderactivation leaderactivation + 0]
  if (selfschemata > 4) AND (selfschemata < 8)[set leaderactivation leaderactivation + 0.5 ]
  if (selfschemata > 7) AND (selfschemata < 12)[set leaderactivation leaderactivation + 1 ]
  ifelse (status > 4) OR (status = 4) [set leaderactivation leaderactivation + 1][set leaderactivation leaderactivation - 1]
  show leaderactivation
end

to checksocialfactors ;; turtle procedure to check social factors of the turtles
  find-others
  if any? others
    [ find-others-activation
      find-othersactivation-and-taskdemand
      let lachange  0
      let s  (1 - leaderactivation) * neti
      let t (leaderactivation + 0.2) * neti
      ifelse (neti > 0) [set lachange  lachange + (0.4 * s) - (0.1 * leaderactivation)] [set lachange lachange + (0.4 * t) - (0.1 * leaderactivation)]
      set leaderactivation leaderactivation + lachange
      ifelse (leaderactivation > maxleaderactivation)[ set leaderactivation maxleaderactivation][set leaderactivation leaderactivation]

        ]
end

to find-others  ;; turtle procedure to find others in the group
  set others other turtles with [mygroup = [mygroup] of myself]
end

to find-others-activation ;; turtle procedure to find others activation in a group
  set othersactivation sum [leaderactivation] of others
end

to find-othersactivation-and-taskdemand
  set neti othersactivation +  0.1 + err
  end

to ilt-match ;; turtle procedure to match prospective leader's perceived characteristics and perceiver's ILT for various dimensions using hamming distance
  find-others
  find-yothers
  let d 0
  let xn 0
  let yn 0
  let x1 0
  let y1 0
  let n 1
  while [n < 6];; there are 5 values
  [ set x1 item xn x
    set y1 item yn y
    set n n + 1
    if (x1 = y1) [ set d d + 0 ]
    if (x1 > y1) [ set d d + (x1 - y1) ]
    if (y1 > x1) [ set d d + (y1 - x1) ]
  ]
  ifelse d <= 2
  [ set leadershipperception leadershipperception +  (5 - d)]
  [ set leadershipperception leadershipperception + 0]

end

to collectivelevel
  find-others
  if any? others[
    set othersperception sum [leadershipperception] of others

  ]
end

to find-yothers
  if any? others[
  set y n-values 5[random 2]
  ]
end

to update-variables
  update-turtles
  update-globals
end

to update-turtles
  ask turtles[
    if(leaderactivation > 2) [ set aLA? 1]
    if(leadershipperception != 0) [ set aLP? 1]
    if(leadershipactivation > 2) [set aLi? 1]
   ; if(leadershipactivationr > 2) [set aLir? 1]
    ;if(leaderactivation > 2) AND (leadershipperception = 0) AND (leadershipactivationr > 0)[ set aLAnLp? 1]
    ;if(leaderactivation < 2) AND (leadershipperception != 0) AND (leadershipactivationr > 0)[ set nLALp? 1]
    ; if(leaderactivation > 2) AND (leadershipperception != 0) AND (leadershipactivationr > 0)[ set LALP? 1]
    ;if(leaderactivation < 2) AND (leadershipperception = 0) AND (leadershipactivationr > 0)[ set nLAnLP? 1]
  ]
end
to update-globals
  set percent-LA (count turtles  with [ aLA? = 1]) / (count turtles) * 100
  set percent-LP (count turtles with [aLP? = 1]) / (count turtles) * 100
  set percent-LI (count turtles with [aLI? = 1]) / (count turtles) * 100
  set percent-LIr (count turtles with [aLIr? = 1]) / (count turtles) * 100
  ;set percent-LAmp (count turtles  with [ LA? = 1 AND motivation = 1 AND priorexp = 1]) / (count turtles) * 100
  set probLA (count turtles with [aLA? = 1]) / (count turtles)
  set probLP (count turtles with [aLP? = 1]) / (count turtles)
  set probLI (count turtles with [aLi? = 1]) / (count turtles)
  ;set percent-aLAnLp (count turtles with [aLAnLp? = 1]) / (count turtles) * 100
  ;set percent-nLALp (count turtles with [nLALp? = 1]) / (count turtles) * 100
  ;set percent-LALP (count turtles with [LALP? = 1]) / (count turtles) * 100
  ;set percent-nLAnLP (count turtles with [nLAnLP? = 1]) / (count turtles) * 100

end

'' '

...