KABELI MEFANE
2009-Aug-25 03:14 UTC
[R] Fw: Re: Simulating data for sampling (stupid question)
Dear All I know that you do not have to help me (as this is not a pure R problem) but please do, i am new to R as a CPI compiler, i just need to do a sample to see which sampling method best works in different situations, therefore since this is for practice purposes nobody will finance a real project thats why i need you to help me direct me as to how simulate data (just direct me,not 100% help). See my attachment for problem formulation, you can even suggest a different problem and how i can simulate it. Problem Formulation: If I want to measure customer satisfaction on say 5000 business outlets that I supply with soft drink. The rating is on a 10 scale point where 1 is lowest and 10 highest. The outlets range from 1 to 5 (1= big supermarkets, 2= medium, 3= Small, 4 = Mini markets, 5 = corner shops). Data: I have to simulate this sort of data for example Outlet type Population N Average Buying Power (L/M) Combined Average Buying Proportions of total buying 1 50 31000 1550000 19.9100835 2 200 13500 2700000 34.6820809 3 350 4500 1575000 20.2312139 4 1000 600 600000 7.70712909 5 3400 400 1360000 17.4694926 Total 5000 50000 7785000 100 L/M =litres per month This means I have to simulate 50 outlets of type 1 who buy between say 20000 and 40000 L/M, 200 outlets of type two buying 12000 – 19999 L/M,… etc. Also I have to simulate ratings randomly from 1 to 10. I really do not know how to simulate data, after simulating I am going to use dollar stratification to sample this data to get info. I want to compare different sampling techniques to see which one is best. My objective is to sample from this data in such a way that my company will benefit from this survey. If I use SRS my survey results may show that customers are satisfied with average rating of 8, but this sample may not include my most valued customers who buy 19 to 54 percent of my stock Best Regards R novice [[alternative HTML version deleted]]
Petr PIKAL
2009-Aug-25 09:19 UTC
[R] Odp: Fw: Re: Simulating data for sampling (stupid question)
Well you shall consult (surprisingly :-) ?sample function and for rating ?runif function as was pointed out earlier Regards Petr r-help-bounces at r-project.org napsal dne 25.08.2009 05:14:00:> Dear All > ? > I know that you do not have to help me (as this is not a pure Rproblem)? but> please do, i am new to R as a CPI compiler, i just need to do a sampleto see> which sampling method best works in different situations, thereforesince this> is for practice purposes nobody will finance a real project thats why ineed> you to help me direct me as to how simulate data (just direct me,not100%> help). See my attachment for problem formulation, you can even suggest a> different problem and how i can simulate it. > ? > Problem Formulation: > ? > If I want to measure customer satisfaction on say 5000 business outletsthat I> supply with soft drink. The rating is on a 10 scale point where 1 islowest> and 10 highest. The outlets range from 1 to 5 (1= big supermarkets, 2=medium,> 3= Small,? 4 = Mini markets, 5 = corner shops).? > ? > Data: I have to simulate this sort of data for example > ? > > > > > > Outlet type > > > Population N > > Average Buying Power (L/M) > > Combined Average Buying > > Proportions of total buying > > > 1 > > 50 > > 31000 > > 1550000 > > 19.9100835 > > > 2 > > 200 > > 13500 > > 2700000 > > 34.6820809 > > > 3 > > 350 > > 4500 > > 1575000 > > 20.2312139 > > > 4 > > 1000 > > 600 > > 600000 > > 7.70712909 > > > 5 > > 3400 > > 400 > > 1360000 > > 17.4694926 > > > Total > > 5000 > > 50000 > > 7785000 > > 100 > > > ? > > ? > > ? > > ? > > ? > > > ? > > ? > > L/M =litres per month > > ? > > ? > ? > This means I have to simulate 50 outlets of type 1 who buy? between say20000> and 40000 L/M, 200 outlets of type two buying 12000 ??? 19999 L/M,???etc.> Also I have to simulate ratings randomly from 1 to 10. > ? > I really do not know how to simulate data, after simulating I am goingto use> dollar stratification to sample this data to get info. I want to compare> different sampling techniques to see which one is best. > ? > My objective is to sample from this data in such a way that my companywill> benefit from this survey. If I use SRS my survey results may show that > customers are satisfied with average rating of 8, but this sample maynot> include my most valued customers who buy 19 to 54 percent of my stock > ? > Best Regards > R novice > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.