Math Operations embedded data involving multiple equations and natural logarithms | XM Community
Solved

Math Operations embedded data involving multiple equations and natural logarithms


Hi there,

I'm wondering if there's a way to use logarithms in a Qualtrics survey using embedded data to and show the result of the equation to the respondent? I've looked at the Math Operation page to start me off and am aware that it has an exponent function.

The respondent would provide the following in an earlier block:
* Female (1=yes, 0=no)
* Age (in years)
* Systolic Blood Pressure (in mmHg)
* Smoking (1=yes or quit within the last year, 0 = otherwise)
* Total Choleterol (in mmol/L)
* HDL Cholesterol (in mmol/L)
* Diabetes (1= yes, 0 = no)
* ECG-LVH (1=definite, 0 = otherwise)

And using the above respondent input data the following calculations will be made:

First:

μ=(ln⁡(t)-x)/y

where x = 18.8144+(-1.2146×x female)+[-1.8443 x ln⁡(age)]+[0.3668 x ln⁡(age)×female]+[-1.4032 x ln⁡(SBP) ]+(-0.3899 x cigarettes)+[-0.5390 x ln⁡(total chol÷HDL) ]+(-0.3036 x diabetes)+(-0.1697 x diabetes x female)+(-0.1362 x ECG-LVH)

where y=exp[0.6536+0.2402(x)]

To calculate:

1-exp⁡(-exp⁡(μ) )

The result of the above equation would then be presented to the respondent.

Is this possible?

Thanks for your help in advance,
Michael
icon

Best answer by JenCX 2 July 2019, 16:24

View original

4 replies

Userlevel 7
Badge +11
I'm not a Qualtrics math wiz but it looks like you can create x and subsequently y fairly easily using piped text and the math operations that you already found. I'm not sure about Mu because I don't see In or t listed in the operations. However, after you build x and y, it's just one more easy calculation to check if your formula for Mu works, so I'd suggest doing that.
Thanks JenCX,

Just to clarify: x cannot be created without a natural logarithm function (i.e. ln) and y cannot be created until x is created. The results of these equations are then used to calculate mu, and then mu is used in the final double exponent equation. t will either be 5 or 10 depending on the stage of the survey flow.

I was wondering whether someone knows a work around within Qualtrics that would enable the use of the natural logarithm function (given that exponents are possible; natural logarithms are the inverse of this function) within embedded data; otherwise I may search for another survey creator that might be able to do this.
Userlevel 7
Badge +11
@mfajardo Ah ha! Yes, I read right over that ln. Sorry about that! There may be a custom code functionality that someone may be able to help you with but in the meantime, I suggest you submit a Feature Request through support.
Userlevel 7
Badge +27
@mfajardo,

You can use JavaScript or a web service to do your calculation.

With JavaScript you attach the script to a question, pipe the values you need into the script, then save the result to an embedded data field.

With a web service you add a web service call to your survey flow and send the inputs as parameters to the web service. The web service script returns the result in a json string which becomes the value of an embedded data field.

Leave a Reply