Calculating percentage commission without losing desire markup - algebra

Suppose I am selling an item with the following conditions:
cost = $100
markup = 10%
commission = 15%
If the item sells at $110, there is a $16.50 commission paid. This obviously takes me below the cost after paying commission.
If I add the commission on top of the $110 as a buffer I get $126.50, at which point a 15% commission of $18.98 comes off that. Subtracting $18.98 from $126.50 gives me $107.52, which is below my desired 10% markup.
What formula would I use to consistently calculate how much commission must be accounted for to ensure the profit markup is always met no matter how the variables change?

The sale price must be greater than
(Cost + Cost * markup) / (1 - commission)
or in your example
(100 + 100 * .10) / (1 - .15)
110 / .85
129.42 (round UP)
Giving a commission of 19.41 and a net of 110.01, less your cost gives you your 10% markup

Or equivalently, cost × (1+markup)/(1-commission)

Related

Paypal Subscriptions - Quantity based - Charge variable amount

On my application, I need to charge users a different amount at a set frequency.
Hourly Fee * No. of Hours = Sum to be charged
(user is expected to fill the timesheet basis which the number of hours will be calculated
and Hourly fee is fixed)
We will charge this sum every week or every month. I thought of using the Paypal's quantity based subscriptions API, but I am not able to find a way to change the number of hours for every period (since the number of hours would change in every period).
Please advise.

Understanding IEEE Floating Point Numbers from crypto exchange

I read as much as I could within my ability to grasp concepts before posting. This is a photo from a crpto currency exchange website (https://www.btse.com/en/futures/ETHPFC). I asked the administrator in the telegram group why is there a difference between the interest rate shown and the number shown once hovering the mouse over the rate (it also returns the same lengthy decimal in scientific notation via API call).
His response was: "Note the website shows 0.00101%. Which is identical to 0.0000101 (the other differences are there because of IEEE floating point numbers)".
Can someone (kindly) explain to me what I am missing?
Here are their calculation methods and example:
(https://support.btse.com/en/support/solutions/articles/43000460020)
Funding Fees Calculation
Funding Fee = Notional Value x Funding Rate
Funding Rates will be updated every minute. When settling the fee, the system will use every minutes' average results in the past 1 hour to calculate the fee.
Minimum funding rate for long positions: 0.001%
Minimum funding rate for short positions: -0.001%
Notional Value = Mark Price x Position Size x Contract Multiplier
Funding Rate = [Max (0, Impact Bid-Perp Index) - Max (0, Perp Index-Impact Ask)] / Perp Index / 24
When the funding rate is positive, Longs pay Shorts; when the funding rate is negative, Shorts pay Longs
Impact Bid Price: The average buy price of the first 10,000 highest bid orders in the Order Book
Impact Ask Price: The average sell price of the first 10,000 lowest ask orders in the Order Book
For example:
BTC Perpetual
Index Price: 1230 USD
Mark Price: 1250 USD
Impact Bid: 1299 USD
Impact Ask: 1300 USD
Position Size: 1000 contracts
Contract Multiplier: 0.001
Notional Value = 1250 x 1000 x 0.001 = 1250
Funding Rate = [Max (0 , 1299-1230) - Max (0, 1230-1300)] / 1230 / 24 = (69-0) / 1230 / 24 = 0.002337
Funding Fee = 1250 * 0.002337 = 2.92125 USD (Long pays to Short)

What is the difference between Coefficient of Regression and Elasticity

I am studying elasticity of demand and how to get the optimal price from elasticity using regression. I have referred Rbloggers and medium blogs to understand the concepts. But still I have a doubt. Say I have a linear equation as below
Sales of Eggs = 137.37 – (16.12)Price.Eggs + 4.15 (Ad.Type) – (8.71)Price.Cookies
Mean of Price.Eggs= 4.43,
Mean of Price.Cookies= 4.37,
Mean of Sales of Eggs= 30
We can deduce the equation as : increase in sales of eggs increases the price of cookies by 8.71 and price of eggs by 16.12.
But in the case of elasticity, we calculate the formula and the elasticity of price of eggs is -2.38 and elasticity of price of cookies is -1.27 which also tells the unit increase in value with respect to dependant variable. What is the difference between these two ? I know the values are different but both meant the same right ? Please advice and correct if I am wrong
Well it depends. I'm going to simplify the model a bit to one product (eggs for example):
Assuming elasticity is not constant and the demand curve is linear:
E = Elasticity
Q = Quantity Demanded
P = Price
t = time
b0 = constant
b1 = coefficient (slope)
See the breakdown for elasticity here
Picture a graph of the Demand Curve with Q on the vertical axis and P on the horizontal axis - because we're assuming Quantity Demanded will change in response to changes in Price.
I can't emphasize this enough - in the case where demand is linear and elasticity is not constant along the entire demand curve:
The coefficient (slope) is the change (difference) in the dependent variable (Q) divided by the change in the independent variable (P) measured in units - it is the derivative of your linear equation. The coefficient is the change in Q units with respect to a change in P units. Using your eggs example, increasing the price of eggs by 1 unit will decrease the quantity demanded of eggs by 16.12 units - regardless of whether the price of eggs increases from 1 to 2 or 7 to 8, the quantity demanded will decrease by 16.12 units.
From the link above, you can see that Elasticity adds a bit more information. That is because elasticity is the percent change in Quantity Demanded divided by the percent change in Price - ie the relative difference in Quantity Demanded with respect to the relative difference in Price. Let's use your eggs model but exclude Ad.Type and Price.Cookies
Sales of Eggs = 137.37 - 16.12 * Price.Eggs
"P" "Qd" "E"
1.00 121.25 -0.13
2.00 105.13 -0.31
3.00 89.01 -0.54
4.00 72.89 -0.88
5.00 56.77 -1.42
6.00 40.65 -2.38
7.00 24.53 -4.60
8.00 8.41 -15.33
See graph of Demand Curve vs Elasticity
In the table you can see that as P increases by 1.00, Qd decreases by 16.12 regardless if it's from 1.00 to 2.00 or 7.00 to 8.00.
Elasticity, however, does change rather significantly relative to changes in price, so even if the change in units for each variable remains the same, the percent change for each variable will change.
A price increase from 1 to 2 is a 100% increase and would result in a change in quantity demanded from 121.25 to 105.13 which is a 13% decrease.
A price change from 7 to 8 is a 14% increase and would result in a quantity demanded change from 24.53 to 8.41 which is a 66% decrease.
If you're interested in learning more about different ways to measure elasticity I highly recommend These lecture slides especially slide 6.26.

What do you do if the sample size for an A/B test is larger than the population?

I have a list of 7337 customers (selected because they only had one booking from March-August 2018). We are going to contact them and are trying to test the impact of these activities on their sales. The idea is that contacting them will cause them to book more and increase the sales of this largely inactive group.
I have to setup an A/B test and am currently stuck on the sample size calculation.
Here's my sample data:
Data
The first column is their IDs and the second column is the total sales for this group for 2 weeks in January (i took 2 weeks as the customers in this group purchase very infrequently).
The metric I settled on was Revenue per customer (RPC = total revenue/total customer) so I can take into account both the number of orders and the average order value of the group.
The RPC for this group is $149,482.7/7337=$20.4
I'd like to be able to detect at least a 5% increase in this metric at 80% power and 5% significance level. First I calculated the effect size.
Standard Deviation of the data set = 153.9
Effect Size = (1.05*20.4-20.4)/153.9 = 0.0066
I then used the pwr package in R to calculate the sample size.
pwr.t.test(d=0.0066, sig.level=.05, power = .80, type = 'two.sample')
Two-sample t test power calculation
n = 360371.048
d = 0.0066
sig.level = 0.05
power = 0.8
alternative = two.sided
The sample size I am getting however is 360,371. This is larger than the size of my population (7337).
Does this mean I can not run my test at sufficient power? The only way I can determine to lower the sample size without compromising on significance or power is to increase the effect size to determine a minimum increase of 50% which would give me an n=3582.
That sounds like a pretty high impact and I'm not sure that high of an impact is reasonable to expect.
Does this mean I can't run an A/B test here to measure impact?

iPhone SDK Present Value function

Present value is the value on a given date of a future payment or series of future payments, discounted to reflect the time value of money and other factors such as investment risk. Present value calculations are widely used in business and economics to provide a means to compare cash flows at different times on a meaningful "like to like" basis.
http://en.wikipedia.org/wiki/Present_value
What would be the best way to tackle this in an Objective-C function?
double retire62 = [benefit62.text doubleValue] * [yearlyReturn.text doubleValue] *12* [lblAgeExpectancy.text doubleValue];
double retire66 = [benefit66.text doubleValue] * [yearlyReturn.text doubleValue] *12* [lblAgeExpectancy.text doubleValue];
double retire70 = [benefit70.text doubleValue] * [yearlyReturn.text doubleValue] *12* [lblAgeExpectancy.text doubleValue];
Im just not familiar with Present Value/
Putting aside your code snippet for a little while, the present value calculation itself is reasonably straightforward, a least in its simpler forms. (It can become a fair bit more complicated if you start to consider more realistic interest with different rates at different terms and such, but if you want to get into that you'll need to do some proper reading up.)
The present value of any single future cash flow is the amount of money you would have to invest now (at the so-called risk-free rate) in order to have the future amount when the time comes. That is, it is the future amount discounted at the specified interest rate.
As a trivial example, suppose you are going to give me $105 in a year's time, and the annual interest rate is 5%. If I have $100 now and invest it at that rate, in a year's time I will have $105, the same amount you are due to give me. So the present value of that future $105 is not $105, but only $100. (This is just a slightly more formal equivalent of observing that a bird in the hand is worth two in the bush.)
Let's take a marginally more realistic example just to see how the calculation works. Suppose I'm due to receive $1000 in 5 years -- how much is that worth to me now?
Assume again that the relevant interest rate is 5% per year, and further assume that it is compounded annually -- which is to say, after a year the first 5% is added to the original amount and this combined amount then accrues interest over the second year, and so on. After each year I have the amount I started with the beginning plus the 5% interest on the amount -- that is 1.05 times what I started with at the beginning of the year. So after five years I would have 1.05 * 1.05 * 1.05 * 1.05 * 1.05 times as much as I had right at the beginning. To have $1000 in five years I would have to invest $1000 / 1.05 * 1.05 * 1.05 * 1.05 * 1.05, or about $784 -- and that's the present value of that $1000.
More generally, you would need to divide the future amount by pow(1 + r, n) for interest rate r and number of years n (or equivalently multiply by pow(1 + r, -n)), and there are simple generalizations for where the interest rate and payments are over different periods (eg, annual rate compounded monthly). See, eg, Wikipedia's compound interest entry for more detail.
OK, back to the question. Coding this calculation in Objective-C is no different from coding it in C. Again using the simple version described above:
double presentValue ( double futureValue, double annualRate, unsigned int years )
{
return futureValue * pow ( 1 + annualRate, -years );
}
You could do this as an Obj-C method rather than a C function, but the essence would be pretty similar. Adding more sophistication in terms of compounding periods and such is left as an exercise.
Note, however, that this doesn't bear very much resemblance to your own code, which looks to be just grabbing values blindly from text fields and multiplying them together. If you find yourself doing maths directly on the contents of views, you probably ought to be hearing alarm bells somewhere.
Not wishing to sound too high-horsey, but it seems to me that you need much more clearly to distinguish the underlying data (we could call it the model if we were being fancy) from the inputs (in other words, what is the user actually providing and what is the program expected to know how to do without them having to think about it). And furthermore, both these things should be considered separately from the UI elements used to represent them.
In other words, you probably need to revisit the whole Model-View-Controller pattern that every iPhone developer is supposed to have tattooed on their heart ;)