Tanto el mal razonamiento como el buen razonamiento son posibles; y en este hecho está el fundamento del lado práctico de la lógica.
C. Sanders Peirce
Hi.
I did not understand the previous recommendation, so I will be more detailed about it.
My agents (turtles) have an "opinion" (numerical value), which is updated according to certain equations. Then, to know the distribution of this opinion I calculate the histogram and I do it in this way (with which I have no problem):
to my-update-plots
set-current-plot "Distribución de opinión"
set-histogram-num-bars ceiling sqrt numero-de-agentes
histogram [opinion] of turtles
end
Now, what I want to do is:
1º Calculate the proportion of agents in each cell (bin) of the histogram.
2º Do some arithmetic calculations with those values and report a number (num). This value (num) would be shown in another graph.
An attempt at this is the following:
to-report grupos
set-histogram-num-bars ceiling sqrt numero-de-agentes
let lista histogram [opinion] of turtles
let proporcion map [i -> i / numero-de-agentes ] lista
let cuadrados map [ x -> x * x ] proporcion
let suma-cuadrados reduce + cuadrados
let num round (1 / suma-cuadrados)
report num
end
The code marks me an error: "LET expected 2 inputs" on the red line. I understand that "histogram" has "two lists" or something like that, and only that of the values is what interests me, but I do not know how to obtain it.
I appreciate your comments in advance.
Thank you
thakns!
I'll review it
--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/2582a83c-1cc3-c856-9204-b3c0dbbc774b%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
--Dra. Norma Leticia Abrica Jacinto
Tanto el mal razonamiento como el buen razonamiento son posibles; y en este hecho está el fundamento del lado práctico de la lógica.
C. Sanders Peirce
Dra. Norma Leticia Abrica Jacinto
Tanto el mal razonamiento como el buen razonamiento son posibles; y en este hecho está el fundamento del lado práctico de la lógica.
C. Sanders Peirce
(from: https://stackoverflow.com/questions/7740503/getting-frequency-values-from-histogram-in-r)res <- hist(rnorm(100))res$counts [1] 1 2 17 27 34 16 2 1 res$density [1] 0.01 0.02 0.17 0.27 0.34 0.16 0.02 0.01
globals [You can move the bin-number slider to pick which bin is shown in the reporters. It looks something like this:
bin-size ; set this to 10 in 'setup'
]
turtles-own [
opinion
]
to setup
clear-all
reset-ticks
set bin-size 10
create-turtles 100 [
set opinion random 100
]
end
to go
tick
end
to-report turtles-in-bin [ #bin-number ]
let bin-bottom #bin-number * bin-size
let bin-top (#bin-number + 1) * bin-size
report count turtles with [ opinion >= bin-bottom and opinion < bin-top ]
end
to-report proportion-in-bin [ #bin-number ]
let #bin-turtles turtles-in-bin #bin-number
report #bin-turtles / count turtles
end

show n-values 10 [ i -> i ] [0 1 2 3 4 5 6 7 8 9]http://ccl.northwestern.edu/netlogo/docs/dict/n-values.html
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/CAFA8Wy8SOrJYZT6vVZT6jAVV8cSYQ0DzNuJEyvV747itCC5LbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
-- Dale Frakes Adjunct Instructor, PhD Candidate PSU Systems Science dfr...@pdx.edu - http://web.pdx.edu/~dfrakes/
to-report histogram-list
report n-values num-bins [ x -> turtles-in-bin x ]
end

To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/5C8B36BD.6010507%40pdx.edu.