Sampling With Replacement How the program works a54p10.sas.

Slides:



Advertisements
Similar presentations
Random BuiltIn Function in Stella
Advertisements

E.g.9 For to do loop for i:=1 to 10 do writeln(i); While do loop i:=1;
Chapter 13: Creating Samples and Indexes 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Assignmnet: Simple Random Sampling With Replacement Some Solutions.
CS470 Lab 4 TA Notes. Objective Simulate the activities of a producer and consumer – Page 326 Use thread synchronization to solve the producer-consumer.
CS 280 Data Structures Professor John Peterson. Next Project YET ANOTHER SORT! We’ll do Quicksort using links instead of arrays. Wiki time.
Assignmnet: Simple Random Sampling With Replacement Some Solutions.
1 Introduction to Biostatistics (PUBHLTH 540) Estimating Parameters Which estimator is best? Study possible samples, determine Expected values, bias, variance,
Презентація за розділом “Гумористичні твори”
Центр атестації педагогічних працівників 2014
Галактики і квазари.
Характеристика ІНДІЇ.
Процюк Н.В. вчитель початкових класів Боярської ЗОШ І – ІІІ ст №4
Random Sampling using RAN#. Random Sampling using Ran# The Ran#: Generates a pseudo random number to 3 decimal places that is less than 1. i.e. it generates.
Generating Random Samples
PROC_CODEBOOK: An Automated, General Purpose Codebook Generator
INTEGERS: adding, subtracting, multiplying, and dividing
Lecture 15 Practice & exploration Subfunctions: Functions within functions “Guessing Game”: A hands-on exercise in evolutionary design © 2007 Daniel Valentine.
Genetic Algorithm.
BY Lecturer: Aisha Dawood. The hiring problem:  You are using an employment agency to hire a new office assistant.  The agency sends you one candidate.
Don't Be Loopy: Re-Sampling and Simulation the SAS® Way David L. Cassell Design Pathways Corvallis, OR.
Духовні символи Голосіївського району
Random Forests Ujjwol Subedi. Introduction What is Random Tree? ◦ Is a tree constructed randomly from a set of possible trees having K random features.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Review of Statistical Terms Population Sample Parameter Statistic.
BMTRY 789 Lecture 6: Proc Sort, Random Number Generators, and Do Loops Readings – Chapters 5 & 6 Lab Problem - Brain Teaser Homework Due – HW 2 Homework.
SS r SS r This model characterizes how S(t) is changing.
1 Impact of Sample Estimate Rounding on Accuracy ERCOT Load Profiling Department May 22, 2007.
ADD To get next term Have a common difference Arithmetic Sequences Geometric Sequences MULTIPLY to get next term Have a common ratio.
Solve a two-step equation by combining like terms EXAMPLE 2 Solve 7x – 4x = 21 7x – 4x = 21 Write original equation. 3x = 21 Combine like terms. Divide.
Module 9.2 Simulations. Computer simulation Having computer program imitate reality, in order to study situations and make decisions Applications?
C++ Programming HW14 Speaker : Ching-Chen Chang Date: 2008/05/23.
A rectangular array of numeric or algebraic quantities subject to mathematical operations. The regular formation of elements into columns and rows.
Multiplication
Multiplication
Comparing Realized and Bi-Power Variation in Lee-Mykland Statistic
Chapter 13: Creating Samples and Indexes
'. \s\s I. '.. '... · \ \ \,, I.
الأستاذ المساعد بقسم المناهج وطرق التدريس
اختر أي شخصية واجعلها تطير!
Chapter 5: Probabilistic Analysis and Randomized Algorithms
Проф. д-р Васил Цанов, Институт за икономически изследвания при БАН
ЗУТ ПРОЕКТ на Закон за изменение и допълнение на ЗУТ
О Б Щ И Н А С И Л И С Т Р А П р о е к т Б ю д ж е т г.
Електронни услуги на НАП
Боряна Георгиева – директор на
РАЙОНЕН СЪД - БУРГАС РАБОТНА СРЕЩА СЪС СЪДЕБНИТЕ ЗАСЕДАТЕЛИ ПРИ РАЙОНЕН СЪД – БУРГАС 21 ОКТОМВРИ 2016 г.
Сътрудничество между полицията и другите специалисти в България
Съобщение Ръководството на НУ “Христо Ботев“ – гр. Елин Пелин
НАЦИОНАЛНА АГЕНЦИЯ ЗА ПРИХОДИТЕ
ДОБРОВОЛЕН РЕЗЕРВ НА ВЪОРЪЖЕНИТЕ СИЛИ НА РЕПУБЛИКА БЪЛГАРИЯ
Съвременни софтуерни решения
ПО ПЧЕЛАРСТВО ЗА ТРИГОДИШНИЯ
от проучване на общественото мнение,
Васил Големански Ноември, 2006
Програма за развитие на селските райони
ОПЕРАТИВНА ПРОГРАМА “АДМИНИСТРАТИВЕН КАПАЦИТЕТ”
БАЛИСТИКА НА ТЯЛО ПРИ СВОБОДНО ПАДАНЕ В ЗЕМНАТА АТМОСФЕРА
МЕДИЦИНСКИ УНИВЕРСИТЕТ – ПЛЕВЕН
Стратегия за развитие на клъстера 2015
Моето наследствено призвание
Правна кантора “Джингов, Гугински, Кючуков & Величков”
Безопасност на движението
' '· \ ·' ,,,,
Suppose I want to add all the even integers from 1 to 100 (inclusive)
Matched Pairs t Test When you are comparing properties before and after a treatment is imposed on the same subjects or units (one population), then do.
Chapter 5: Probabilistic Analysis and Randomized Algorithms
Review of basic operations and vocabulary
Representative sampling By Majed Muati. Sampling Methods Representative Samples. Random Sampling. Systematic Sampling.
Presentation transcript:

Sampling With Replacement How the program works a54p10.sas

The Simulation part of SRSWR N=3, n=2 %LET total=6; *Total number of elements in population; %LET tsamp=3; *Total number of elements in the sample; %LET nsamp=40; *Number of samples to Select ; DATA d (KEEP=sample sid1-sid3 s1-s3 ); SET pop1; ARRAY x{&total} ; *Original values; ARRAY id{&total}; *Original ids; ARRAY s{&tsamp}; *Sample; ARRAY sid{&tsamp}; DO sample=1 to &nsamp; DO j=1 TO &tsamp; *Randomly select permutations; rn=INT(&total*RANUNI(54231))+1; s{j}=x{rn}; sid{j}=rn; END; OUTPUT; END; RUN;

The Simulation part of SRSWR N=3, n=2 (without macro vars) DATA d (KEEP=sample sid1-sid3 s1-s3 ); SET pop1; ARRAY x{6} ; *Original values of response; ARRAY id{6}; *Original subject ids; ARRAY s{2}; *Sample values; ARRAY sid{2}; *Sample subject ids; DO sample=1 to 40; * Number of samples to select; DO j=1 TO 2; * Randomly select a subject; rn=INT(6*RANUNI(54231))+1; s{j}=x{rn}; sid{j}=rn; END; OUTPUT; END; RUN;

Uniform random number generator RANUNI(54231) A function in SAS It picks at random a number between 0 and 1 Example: x=RANUNI(3242); x= Problem: Write a SAS program to generate 10 uniform random numbers between 0 and 1, and list the numbers.

Uniform random number generator Example: x=RANUNI(3242); x= Goal: To randomly select a subject in a population of N=6 subjects. Strategy: Multiply random number by (N): x1=6*RANUNI (3242); Example: x1= The random number now ranges from 0 to 6. Take the integer part: x2=INT(6*RANUNI(3242)); Example: x2=1 Add 1 to make it go from 1 to N: x3=INT(6*RANUNI(3242))+1; Example: x3=2;