oscartgiles / pythurstonian Goto Github PK
View Code? Open in Web Editor NEWA public snapshot of the PyThurstonian repository, which will be released later this year
License: MIT License
A public snapshot of the PyThurstonian repository, which will be released later this year
License: MIT License
Hey Oscar!
This packages looks really cool. I've been playing around with it since yesterday, and am liking the functions. Just wanted to ask if/how one could go about working with Thurstonian latent utilities directly? Is this even possible?
I've tried your simulation using two within-subject conditions, with latent "beta" utility parameters corresponding to random samples from independent Gaussian distributions Condition 1 = [0.0, 1.0, 2.0], and Condition 2 = [0.0, 0.1, 0.2], where the variance of each is fixed to 1. Your results from the script in terms of permutations and Kendall's W are replicated perfectly, but when I dig into the posterior samples of the model, results seem odd.
If I'm following your code and previous discussions over at the Stan forum correctly, the z_hat
parameter should correspond to the posterior draws of the Gaussians, fixing the first ranking at zero. The beta
parameter forms the posterior difference of each ranking from the first (these relative differences appear to be the crux of PyThurstonian's modelling approach).
Working with the differences directly:
#Extract posterior samples per condition
C1_Beta = [myThurst.samples['beta'][i][0] for i in range(9999)]
C2_Beta = [myThurst.samples['beta'][i][1] for i in range(9999)]
#Find mean of differences from first rank per condition
np.array(C1_Beta).mean(axis = 0), np.array(C2_Beta).mean(axis = 0)
# Returns:
(array([0. , 1.00341984, 9.85625661]),
array([0. , 1.29277174, 1.44932662]))
This doesn't look quite right to me - are the differences relative to the first ranking within each condition really preserved accurately?
Why is the difference between the first and third object in Condition 1 blown out to this extent? Condition 2 results looks more accurate to our simulated data, but why are the differences centred on 1 and not 0? Finally, if the difference between the first and second rank in Condition 1 on the normal is ~1, and ~0.1 in Condition 2, why do they yield similar estimated differences between the conditions? Do the differences in latent scale dimensions not translate across conditions?
Just for reference, checking the variability of estimates in terms of the posterior distributions
pd.DataFrame(C1_Beta).loc[:,1:2].plot(kind='density')
pd.DataFrame(C2_Beta).loc[:,1:2].plot(kind='density')
I've tried a similar process for drawing directly from z_hat
and the same broad pattern emerges.
Any guidance here?
Support:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.