[R] Odp: Fw: Re: Simulating data for sampling (stupid question)

Petr PIKAL petr.pikal at precheza.cz
Tue Aug 25 11:19:03 CEST 2009


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 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]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list