My population consists of 90 administrative zones that divide the city. Of those zones, only 20 received the treatment. After carrying out PSM, I have 17 zones in the treatment group and 17 in the control group, with a high level of balance on co-variables.
I know scholars recommend a minimum of 100 observations in each group, but considering the size of my population of interest (90), is it okay if I proceed with my research? I have already invested a substantial amount of work getting this far.
there are four gifts, which cost 100, 30, 5, 2. You have $89 to spend on them. now you want to spend as much your money as possible to buy minimum number of gifts (I know it doesn't sound reasonable at first). For example, in this case, starting from the most expensive one, you cannot afford it and thus you can only choose two $30 gifts. Now you have $29 left and you can do 5 $5 gifts and then 2 $2 gifts, totalling 9 gifts with $0 left. This is the plan. The desired output is 9. I need a set of codes that can generate this kind of plan no matter what is inputted at first. If i change the number to 40, 30, 8, 3 and $100, the best plan can still be outputted.
I got hints that we can input the number from big to small. For example, list1=[100,30,5,2,89] (the cost of gifts first and then the total money you have). And then select maximum amount of the most expensive gifts and see if there's any amount left for other gifts.
it is a beginner question so don't make it look too hard. Just use for loops and while loops (like you just started to learn).
no need to generate random numbers, you can use 100, 30, 5, 2 or other numbers you like.
Thx so much guys I need ur help!!!! kinda desperate now.
I have a scenario where I am comparing the output of an item to its required output which is done weekly. I calculate the percentage of actual output against required output which can be seen in the Requirement Met % row below.
Where I'm struggling is with the recovery time metric. I'm trying to calculate the recovery time where Actual Output is short of the required output, and how long it takes to back fill a shortage.
So for week 1 in the image above, only 90% of the required output was fulfilled and therefore had a shortage of 10%. I'd then look at week 2 to fill week 1's shortage, however week 2 is also short 10% from its required output. So I'd then need to look at week 3 to fulfill week 1's shortage. This is possible as week 3 has more output than its required output (113%) and enough to fulfill week 1's shortage. This means it took an extra 2 weeks for week 1's requirement output to be met. The same would apply to week 2, it would look at the next week until its required output shortage can be met.
After week 3's required output and week 1's shortage are deducted from week 3's actual output, that leaves 3% which is not enough to fulfill week 2's required output. So I'd look at week 4 to see if it has enough leftover output to fulfill week 2's shortage...which it does. And so on and so on.
This would show the recovery time for each week.
I am working in alteryx but have not attempted to do this yet as I haven't worked out how to calculate this figure. If not alteryx I could do it in power BI but it's really how to calculate this metric that I'm after.
Thanks,
Tom
So this is really stumping me, and I think it should just be a linear equation.
Suppose I am charging my client $1000 for a good or service. The client wants to charge this to their credit card. I use Square as my payment processor, and they take a 2.75% cut of the transaction.
This cut is $27.50 for a $1000 sale, so the settlement ends up being only $972.50. Suppose I want the customer to pay the $27.50 fee, but they also want that fee charged to their card.
Well, if I charge $1027.50, Square will take a 2.75% cut of that amount, so their cut will be $28.26, and my settlement would be $999.24.
It's closer to $1000, but not exactly $1000.
I determined on a spreadsheet through trial and error that I'd need to charge $1028.28 to offset the processing fee and get my desired exact settlement.
I've been wracking my brains to think of a simple algebraic equation. It seems like it should just be a single variable, but maybe not?
Welcome to Stack Overflow. Not sure if it belongs on SO (not a programming question), but this is what my arithmetic teacher would say:
You charge X dollars. You want to get $1000 after fees. Fees are 2.75%; so you get 97.25%. Therefore X * .9725 = 1000. X = $1,028.28
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Suppose that a fast-food restaurant sells salad and burger. There are
two cashiers. With cashier 1, the number of seconds that it takes to
complete an order of salad is uniformly distributed in
{55,56,...,64,65}; and the number of seconds it takes to complete an
order of burger is uniformly distributed in {111,112,...,,129,130}.
With cashier 2, the number of seconds that it takes to complete an
order of salad is uniformly distributed in {65,66,...,74,75}; and the
number of seconds it takes to complete an order of burger is uniformly
distributed in {121,122,...,,139,140}. Assume that the customers
arrive at random times but has an average arrival rate of r customers
per minute.
Consider two different scenarios.
• Customers wait in one
line for service and, when either of two cashiers is available, the
first customer in the line goes to the cashier and gets serviced. In
this scenario, when a customer arrives at the restaurant, he either
gets serviced if there is no line up, or waits at the end of the line.
• Customers wait in two lines, each for a cashier. The first customer
in a line will get serviced if and only if the cashier for his line
becomes available. In this scenario, when a customer arrives at the
restaurant, he joins the shorter line. In addition, we impose the
condition that if a customer joins a line, he will not move to the
other line or to the other cashier when the other line becomes shorter
or when the other cashier becomes free.
In both scenarios considered,
a cashier will only start serving the next customer when the customer
he is currently serving has received his ordered food. (That is the
point we call “the customer’s order is completed”.)
... Simulation
For
each of the two scenarios and for several choices of r (see later
description), you are to simulate the customers
arriving/waiting/getting service over a period of 3 hours, namely,
from time 0 to time 180 minutes, where you assume that at time 0 there
is no customer waiting and both cashiers are available; The entire
period of 3 hours is to be divided into time slots each of 1 second
duration. At each time slot, with r/60 probability, you make one new
customer arrive, and with 1 − r/60 probability you make no new
customer arrive. This should give rise to an average customer arrival
rate of r customers/minute, and the arrival model will be reasonably
close to what is described above. In each time slot, you will make
your program handle whatever necessary.
... Objectives and
Deliverables
You need to write a program to investigate the following.
For each of the two scenarios and for each r, you are to divide the
three-hour simulated period into 10-minute periods, and for every
customer arriving during period i (i ∈ {1,2,...,18}), compute the
overall waiting time of the customer (namely, from the time he arrives
at the restaurant to the time when his order is completed. You need to
print for each i the average waiting time for the customers arriving
during period i. Note that if a customer arriving in period i has not
been served within the three-hour simulated period, then his waiting
time is not known. So the average waiting time for customers arriving
in this period cannot be computed. In that case, simply print “not
available” as the average waiting time for that period.
So, this program deals with hours, minutes, and seconds.
Would it be best to make a three-dimensional array as such:
time[3][60][60]
A total of three hours, with 60 minutes within, with 60 seconds within.
Alternatively, I was thinking that I should make a "for-loop" with this structure:
for (time=0;t<10800;t++)
Every iteration of this loop will represent one second of the three hour simulation (3hx60mx60s=10800 seconds).
Am I on the right track here guys? Which method is more plausible. Are there other arrays that are critical for this program?
Help is appreciated, as always!
It's almost always best to have your internal representation of time be in seconds; you'll have a much easier time working with your for loop than with a three-dimensional array. One nice convention is to write it as
MAX_SECONDS = 3 * 60 * 60
for (t=0;t<MAX_SECONDS;t++)
The data structure to look into for this project is, appropriately enough, a queue. This can be implemented using arrays, but will require some extra work.