On 17/06/2024 11:43, Riccardo (Jack) Lucchetti wrote:
On 17/06/2024 10:28, Sven Schreiber wrote:
> This looks very nice, but indeed I'd say that a histogram
(OP) refers
> to continuous variables.
Possibly. That would require a completely different approach, though. In
those cases, I'd think kernel density estimates would be more advisable.
I mean, something like this:
<hansl>
function void multi_density(list L)
n = nelem(L)
totrows = 0
matrices kd = array(n)
loop foreach i L
kd[i] = kdensity(L.$i)
totrows += rows(kd[i])
endloop
matrix X = mshape(NA, totrows, n+1)
k = 1
loop i = 1 .. n
nr = rows(kd[i])
X[k:k+nr-1, {n+1, i}] = kd[i]
k += nr
endloop
print X
cnameset(X, varnames(L) + defarray("x"))
gnuplot --matrix=X --with-lines --output=display
end function
open card_krueger94.gdt
list L = 23 24 42 43
multi_density(L)
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------