Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Can I use a color bar chart to show the three numbers and probabilities

  • LISHANGQI
  • LISHANGQI's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #217985 by LISHANGQI
Dear all, 

May I ask if  I can display some numbers and corresponding probabilities through a colorful bar chart, by coding technique? 

I want to display several numbers and probabilities to show an Expected travel time under uncertainty.  If a respondent reported a travel time of "14mins", I  want to display a series of numbers (11,16 27) and probabilities such as  0-11mins (50%),11-16mins(20%) 16-27mins(20%) to represent the expected travel time of an alternative travel mode.  I attached the picture in the attachment. 

Many thanks for your attention. 

Best regards, 
Shangqi
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #218005 by tpartner
This is more of an HTML exercise than LimeSurvey.

Your probabilities only add up to 90%. Are they to be fixed values?

Are the relationships between the reported travel time and the three displayed numbers fixed (pre-defined multiplication values)?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • LISHANGQI
  • LISHANGQI's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #218037 by LISHANGQI
Thanks for your reply!

Sorry for the unclear description , these 3 values can define 4 ranges and the probabilities add up to 100% 0-11mins (50%),11-16mins(20%) 16-27mins(20%), more than 27mins(10%).

These values are fixed. Actually, these 3 values are 5th 7th 9th deciles of a predefined lognormal distribution basing on the reported travel time and a level of an attribute. In the beginning, we would have liked to calculated these 3 values in real-time in the background of Limesurvey, but then we don't think Limesurvey has such ability. So finally we decided to calculate these values in advance by ourselves and directly line these values to certain answers.
For example, if the reported travel time is 12mins, then created 4 attribute levels are (12,13,15)(9,14,23) (7,12,27) (5,10,27).

Then my question is if I can generate a color bar chart to display these series of numbers and corresponding probabilities or not.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #218046 by tpartner

the probabilities add up to 100% 0-11mins (50%),11-16mins(20%) 16-27mins(20%), more than 27mins(10%).

I'm confused. This is not what your mockup image indicates.

So now you want 4 colored bar elements for a reported travel time?

Can you explain the math required to generate the numbers?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • LISHANGQI
  • LISHANGQI's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #218095 by LISHANGQI
Dear Mr. Partner,

Strangely it seems that my reply on Friday was failed. Sorry for the late. I'll explain it again.
Actually, I'm designing an SP experiment. There are two attributes of an alternative which are PLANED travel time and coefficient of variation. By assuming that travel time is following the lognormal distribution: lognormal(t, cv), we would like to display uncertain travel time by a colored bar chart. This bar chart contains 3 values which are the 5th 7th and 9th deciles of the lognormal(t. cv). So, One colored bar element for one reported travel time.
It will be like:

A B
Expected travel time bar1 bar2
please choose the mode: o o

For the math base, let me show you the code that I used in SAS to calculate the deciles of the lognormal distribution.
data convert;
m = 2; v =0.4; /* reported travel time and coefficient of variations*/
phi = sqrt(v**2 + m**2);
mu = log(m**2/phi); /* mean of log(Y) */
sigma = sqrt(log(phi**2/m**2)); /* std dev of log(Y) */


Value1= quantile ('LOGNORMAL',0.5,mu,sigma);
Value2= quantile ('LOGNORMAL',0.7,mu,sigma);
Value3= quantile ('LOGNORMAL',0.9,mu,sigma);


put value1=;
put value2=;
put value3=;

run;

Thanks a lot for your kind attention!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #218104 by tpartner
I'm sorry, I cannot help - that math is beyond what I can provide.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • LISHANGQI
  • LISHANGQI's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 11 months ago #218125 by LISHANGQI
Okay, thanks again for your time and effort!
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose