adjusting costs, from different yrs, for inflation

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)
Post Reply
xav90
Posts: 8
Joined: Tue Feb 21, 2023 2:29 am

adjusting costs, from different yrs, for inflation

Post by xav90 »

Hi all,
New to Jamovi and wondering if anyone might be able shed light on the following data clean-up challenge I'm facing. In brief I'm working with cost data related to medical care from different points in time. The points in time are broken down by year and quarter (2018 Q1, 2019 Q3, etc.) and I am currently trying to adjust all the cost to Q1 2021 dollars. Is there any way using transformed or computed variables I can establish logic that essentially creates my new corrected cost variable based on the year.

For example: if encounter period == 2018 Q1 then corrected cost == original cost multiplied by X, if encounter period == 2019 Q1 then corrected cost == original cost multiplied by Z, and so forth and so on.

Thanks for any help. Hoping to avoid going back to doing this all in excel.
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: adjusting costs, from different yrs, for inflation

Post by jonathon »

transformed variables would be ideal for that:

https://blog.jamovi.org/2018/10/23/transforming-variables.html

cheers

jonathon
xav90
Posts: 8
Joined: Tue Feb 21, 2023 2:29 am

Re: adjusting costs, from different yrs, for inflation

Post by xav90 »

Thanks for the quick response Jonathon! Trying my hand at the transform functionality now.

I can get the transform function to work if I only have one recode condition, however if I try to add an additional recode condition such as (if $source == Q1 2018) I keep getting a "the formula is mis-specified" error message. I'm guessing the error is with my if statement since with only one recode condition it works without issue.

Should I be setting up the recode condition differently?

Thanks all for any help!

best,
Xavier
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: adjusting costs, from different yrs, for inflation

Post by jonathon »

if your variable name has spaces in it, you have to surround it with backticks (backtick key should be at the top left of your keyboard).

i.e.

if $source == `Q1 2018`

jonathon
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: adjusting costs, from different yrs, for inflation

Post by jonathon »

sorry, that's if you're comparing the value in $source against the value in the `Q1 2018` column ... i'm guessing you're wanting to compare the $source against the text value "Q1 2018" in which case you'll want to use quotes
xav90
Posts: 8
Joined: Tue Feb 21, 2023 2:29 am

Re: adjusting costs, from different yrs, for inflation

Post by xav90 »

Bingo! Thanks so much for clarifying and again for the super fast response.

Much appreciated!
Post Reply