3 Pages

Exercise_9

Course: STAT 517, Fall 2009
School: Los Angeles Southwest...
Rating:
 
 
 
 
 

Word Count: 973

Document Preview

Exercise Class 9 This exercise is based upon Chapter 7 of Delwiche and Slaughters The Little SAS book. We will study two dierent macros here. Take your time and be sure you understand every step; be sure to look at intermediate data sheets in the WORK library so that you understand the macros actions. The rst macro was introduced in class. When running this macro in Leconte 124, I needed to include .. in between...

Register Now

Unformatted Document Excerpt

Coursehero >> California >> Los Angeles Southwest College >> STAT 517

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Exercise Class 9 This exercise is based upon Chapter 7 of Delwiche and Slaughters The Little SAS book. We will study two dierent macros here. Take your time and be sure you understand every step; be sure to look at intermediate data sheets in the WORK library so that you understand the macros actions. The rst macro was introduced in class. When running this macro in Leconte 124, I needed to include .. in between &strata and csv in the rst INFILE statement; on my laptop, this wasnt necessaryI only needed one period. Ive included the version with two periods. You should be able to tell from the LOG le if the correct data set name (upurban.csv) was assigned by the macro; if not, adjust accordingly. The macro computes the probability that sampling units are included in a sample of size 2, when sampling without replacement with unequal sampling probabilities. In class, we had shown that if unit i has sampling weight i , then the probability it is selected would be: P (i) = P (i|i selected on rst draw) + P (i|i selected on second draw) = i j i + j = i 1 + 1 j 1 j j=i j=i The strata macro includes a DATA step with a nested DO loop. It looks complicated, but the actual macro features are really not that sophisticated&n is used mostly to modify the DO loop upper limit, and &strata is used to modify le names, and thats about it! Download and save upurban.csvits referred to as the trac intensity data on the web page. You can also go ahead and run the entire macro; several datasets will be created. Be sure to step through the code and take a look at them: Data set c drops the county name. Data set d transposes the data so that trac intensities are more easily converted to propotions (remember that SAS handles row operations easier than column operations). Data set e creates proportions from the trac intensities. Data set one cleans up some variables. Data set two computes our sampling probabilities. Data set three cleans up after our calculations. Data set four recaptures the county names. 1 Notice that were using DO and not %DO here; thats because were looping within a DATA step, and hence dont need the added exibility. Just because were writing a macro doesnt mean we need to use macro statements indiscriminately. The rest of the macro is relatively routine. Data four looks a little oddwe use firstobs here because when this program was rst written, the Stat Lab used to only compute sampling probabilities for counties that had actually been sampled, and so we wouldnt necessarily read the entire list of county names. We dont use a match merge in final add to the county names back into the data set since we never changed the order of the variables. Add up the sampling probabilities for the three countieswhat do you think is the signicance of the sum? In our second macro, we want to perform a series of simple linear regressions. Our macro should be able to accept a single dependent variable and a list of independent variables, and then construct regressions on each independent variable in turn. Lets start with a straightforward example, and then add a couple important features on our way to our nished macro. Our data set consists of assessment tests for a group of students. Our dependent (response) variable will be read. For our rst attempt, well simply use some macro variables. Go ahead and run all the commands through: ... proc reg data=hsb2; model read=&indvar; run; We actually just read in the macro regall, but I dont want to use it just yet. The inclusion of &SYSDAY and &SYSDATE is a little gratuitous here. Otherwise, you see a typical use of %LET commands to perform a multiple linear regression. The %scan function is new; %scan(string,i) that can save element i from string, where the elements are separated by spaces (as we did here) or by delimiters. Delimiters can be specied as a third argument to %scan. To conduct 4 simple linear regressions on each of those 4 variables, we could construct a macro that accepted a dependent variable, and a set of independent variables. As a rst attempt, we would likely nd it easiest to also include the number of independent variabl...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Los Angeles Southwest College - STAT - 517
STAT 517: Delwiche/Slaughter Chapter 1Hitchcock/GregoChapter 1: Introduction to SAS SAS programs: A sequence of statements in a particular order.Rules for SAS statements: 1. Every SAS statement ends in a semicolon!; 2. Upper/lower case does no
Los Angeles Southwest College - STAT - 706
STATISTICS 706 SYLLABUS Fall 2005John M. Grego MW 4-5:15 BA 204 Oce Hrs: MW 2:30-4:00 200F Leconte 777-5110 grego@stat.sc.eduText Lecture Notes and Design and Analysis of Experiments, Sixth Edition by Douglas C. Montgomery Attendance Though attend
Los Angeles Southwest College - STAT - 517
STAT 517: Delwiche/Slaughter Chapter 2Hitchcock/GregoChapter 2: Getting Data Into SAS Data stored in many different forms/formats. Four categories of methods to read in data.1. Entering data directly through keyboard (small data sets) 2. Crea
Los Angeles Southwest College - STAT - 740
Project Report guidelines The project reports can include several different formats: a simulation exercise, a data analysis, a discussion of an on-going debate, a discussion of a method not studied in class. The first and last will be the more typica
Los Angeles Southwest College - STAT - 770
Project Report guidelines The project reports can include several dierent formats: a data analysis, a discussion of an on-going controversy, a discussion of a method not studied in class. The latter will be the more typical form, and that is the form
Los Angeles Southwest College - STAT - 740
STAT 740 Statistical ComputingJohn M. Grego Office Hours MW 1:30-3 grego@stat.sc.edu Room 200F Phone 777-5110Text and Supplementary Resources. There is no required text, but Monte Carlo Statistical Methods by Robert and Casella covers many topics
Los Angeles Southwest College - STAT - 770
Oral Report guidelines There is not much time to speak during the oral report; I nd it a good idea to focus on one or two of your most interesting elements rather than rush through a comprehensive presentation of your entire report. If you feel you m
Los Angeles Southwest College - STAT - 740
Oral Report guidelines There is not much time to speak during the oral report; I nd it a good idea to focus on one or two of your most interesting topics rather than rush through a comprehensive presentation of your entire report. Do not worry if the
Los Angeles Southwest College - STAT - 517
Ch 11 Graphicsq Managing graphics windows q 1-d, 2-d and 3-d plotting q Interactive graphics Fall 2004 Don Edwards and the University of South Carolina1R graphicsq High level of functionality q Like SAS/Graph, number of options can be intimida
Los Angeles Southwest College - STAT - 517
Ch 12 Function writingq Inputting functions q Function writing examplesqPooled t-test qPlotting Fall 2004 Don Edwards and the University of South Carolina1Inputting functionsq Work from a text file q Fixing and sourcing q Re-editing2Poole
Los Angeles Southwest College - STAT - 506
I.2 Examples To Illustrate DOE Conceptst t1. Optimally Feeding Fish 2. Targeting A Process/Reducing Process Variation 3. Improving A Process 4. Weighing Two Objects 5. Baking Bread 6. Mitigating Noise Factors 7. Comparing Tires Sony USA ve
Los Angeles Southwest College - STAT - 740
Notes on Kernel Density EstimationThe R function density handles most of the estimation approaches we studied in class. R also has a library (KernSmooth) of kernel density functions, but it seemed a bit piecemeal and outdated. We can load the datase
Los Angeles Southwest College - STAT - 506
I.4 Implementation Issuest tFundamentals of Problem Solving DOE Implementation Issues DOE Stages Helicopter Experiment Project ReportstProblem Solving/DOELevels of UnderstandingI.4.1The Center for Reliabilty and Quality Sciences Depart
Los Angeles Southwest College - STAT - 506
I.5 Taguchi's Philosophyt t t t tSome Important Aspects Loss Functions Exploiting Nonlinearities Examples Taguchi Comments and Criticisms5.1The Center for Reliabilty and Quality Sciences Department of Statistics The University of South Carolin
Los Angeles Southwest College - STAT - 706
Designs with Randomization Restrictions RCBD with a complete factorial in each block A: Cooling Method B: Temperature Conduct ab experiments in each blockDesigns with Randomization Restrictions All factors are crossedYijk = + i + j + ij
Los Angeles Southwest College - STAT - 706
Population Marginal Means Two factor model with replication Yijk = ij + ijk , k = 1, , nij Yijk nijYij. j k j Yi. = = nij nijn E (Y ) = nij j i . ij jjjij~ = i.Population Marginal MeansE (Yi. ) = E (Y. j . ) = E (Y. ) =n ij j
Los Angeles Southwest College - STAT - 706
Resource Allocation Given N observations, how should we allocate them to a treatments?Minimize V (Y ) subject to N = ni. 1 1aai Use a Lagrange multiplier and minimizea N -n F= + i 1 ni 1 a 2Resource AllocationF =- 2 -=0 ni ni
Los Angeles Southwest College - STAT - 706
Nested Designs Ex 1-Compare 4 states' low-level radioactive hospital waste A: State B: Hospital Rep: Daily wasteNested Designs Ex 2-Compare tobacco yield/acre in 5 counties A: County B: Farm Rep: Field Yield/acre Other Ex-Tick study, Clas
Los Angeles Southwest College - STAT - 706
Estimability Effects model:Yij = i + ij = + i + ij , j = 1, , n i = i - Linear combinations of parameters are estimable only if they can be expressed as linear combinations of the cell means { i}Estimability Linear combinations of cell
Los Angeles Southwest College - STAT - 770
data crab;input color spine width satell weight; if satell=0 then bisat=0; else bisat=1; weight=weight/1000; cards;3 3 28.3 8 30504 3 22.5 0 15502 1 26.0 9 23004 3 24.8 0 21004 3 26.0 4 26003 3 23.8 0 21002 1 26
Los Angeles Southwest College - STAT - 519
StateRegion1991199019802010AreaPopDens MedAge<18>65SectionMaineNE123512281125145335.440.0134.325.113.41NewHampshireNE1105110992115259.4123.2033.325.311.61VermontNE5675635116549.661.3033.425.611.81Massa
Los Angeles Southwest College - STAT - 519
Here are the commands we used in exploring bounds on the error ofestimation in confidence intervals for a mean collected from a simple random sample in Minitab. To look at the sample size neededover a wide range of choices of B and sigma, we need
Los Angeles Southwest College - STAT - 517
These are various college football scoresfrom early in the 2004 season.The first column is the visiting team, the second the visitor's score,then the home team and their score.The fifth column is a note about the game and the sixth is how much a
Los Angeles Southwest College - STAT - 770
m2logL=function(Lambda){2*Lambda-20-20*log(Lambda/10)-qchisq(.95,1)}Lambda=seq(2,20,by=.5)plot(Lambda,m2logL(Lambda)+qchisq(.95,1),type="l",ylab="-2logL")abline(h=qchisq(.95,1)uniroot(m2logL,interval=c(3,10)$rootuniroot(m2logL,interval=c(10,25)$
Los Angeles Southwest College - STAT - 506
macro rse x1 x2 ymcolumn x1 x2 y zmconstant nrandlet nrand=count(x1)rand nrand z;normal 0 .6.let y=18.5+2.376*x1+1.2*x2-.0234375*x1*x1-.02*x2*x2+.0125*x1*x2+zendmacro
Los Angeles Southwest College - STAT - 517
Maalea sail sch 75.00 Maalea sail yac 32.95 Lahaina sail cat 62.00 Maalea power cat 22.00 Maalea sail sch 47.50 Maalea power cat 28.99 Maalea power y
Los Angeles Southwest College - STAT - 770
Final Exam 1. A researcher is testing the use of three different formats for the same product: Print, Online, CD. Respondents indicated their use of the product on an ordinal scale (1=Never, 2=Rarely, 3=Sometimes, 4=Often/Always). The data is availab
Los Angeles Southwest College - STAT - 740
Markov Chain Monte Carlo ExerciseIn this exercise, we will study an implementation of the Metropolis-Hastings algorithm for the Ising model, and work with BRugs on selected machines on which it has been downloaded. I would encourage you to study BRu
Los Angeles Southwest College - STAT - 740
Reading a function into RThe R function buffon is available on the website as a text le. The le actually names the function: buffon=function(n,l,p){ . . . } We use the source command to read the le. We do not have to use an R assignment (= or <-) to
Los Angeles Southwest College - STAT - 770
Section 3.4 Computer Exercise1. We will be working with the Hog data; copy the SAS program (listed as Chapter 2 contingency table on the webpage) into SAS. Add CMH1 as an option to the TABLES command to obtain the M 2 statistic for the default score
Los Angeles Southwest College - STAT - 740
Calling Fortran Subroutines in R on a PCRefer to Brian Habings webpage for downloading and installing Fortran from the MinGW website. The material presented here is consistent with the portion of Brians website that deals with running Fortran subrou
Los Angeles Southwest College - STAT - 740
Bootstrap ExerciseSome nonparametric bootstrap condence interval techniques are suciently easy to implement that you should consider writing your own. Working with the breast cancer data, we can construct 95% condence intervals for the 25% trimmed m
Los Angeles Southwest College - STAT - 706
Midterm 1. In a Complete Randomized Design, 7 dierent levels of baking powder were tested for their eect on relative rise of biscuit dough. 4 biscuits were baked using each recipe. Use = .05 for all tests. (a) Test the cell means model and examine t
Los Angeles Southwest College - STAT - 517
STAT 517: Final ExamProvide code, output, and answers in either Word, PDF, RTF, or text format; try to combine les as much as possible before sending them to me. Work independently. 1. A hostess at a restaurant recorded tips received each day over t
Los Angeles Southwest College - STAT - 517
STAT 517: AppendicesHitchcockGregoSAS and other packages SAS can interact with other packages in a variety of different ways. We will brieydiscuss SPSSX SUDAAN IML SQL will be discussed in more detailUniversity of South CarolinaPage 1
Los Angeles Southwest College - STAT - 706
Homework 1 1. For the data in Problem 3.36, use orthogonal polynomial contrasts to test whether or not a linear model is better than an intercept model; whether or not a quadratic model (with a linear term) is better than an intercept model. Are eith
Los Angeles Southwest College - STAT - 706
Homework 1 1. For the following data, use orthogonal polynomial contrasts to test whether or not a linear model is better than an intercept model; whether or not a quadratic model (with a linear term) is better than an intercept model. Are either of
Los Angeles Southwest College - STAT - 770
Midterm Exam 1. Consider the following 2X2 table with xed row and column marginals: 12 3 15 (a) What is the range of n11 ? (b) Consider the exact test of Ho : = 2 vs. HA : > 2 ( = .05). Find the rejection region and compute a p-value for this test.
Los Angeles Southwest College - STAT - 706
Latin Square Design Traditionally, latin squares have two blocks, 1 treatment, all of size n Yandell introduces latin squares as an incomplete factorial design instead Though his example seems to have at least one block (batch) Latin squares hav
Los Angeles Southwest College - STAT - 706
Chapter coverage Part A 1: Practical tools 2: Consulting 3: Design Principles Part B (4-6) One-way ANOVA Part C (7-9) Factorial CRD Part D (10-12) Unbalanced CRDChapter coverage Part E (13-15) Questioning Assumptions Part F (16-18) ANC
Los Angeles Southwest College - QARTOD - 3
Quality Assurance of Real-Time Oceanographic Data (QARTOD III)Scripps Institution of Oceanography, La Jolla, CA November 2-4, 2005Day 1 (Wednesday, November 2, 2005)Time 7:30 - 8:30am 8:30 8:45 8:45 9:15 Topic Continental Breakfast/Registration
Los Angeles Southwest College - QARTOD - 4
QARTOD IV AgendaFourth Workshop on the QC/QA of Real-Time Oceanographic Data June 21 - 23, 2006Woods Hole Oceanographic Institution Clark 507/Quissett Campus WEDNESDAY - JUNE 21, 20067:30 - 8:30 8:30-9:20 REGISTRATION & CONTINENTAL BREAKFAST INTR
Los Angeles Southwest College - QARTOD - 4
QARTOD IV June 21-23, 2006QARTOD IV: Breakout Group DescriptionJune 21 23, 2006 Woods Hole Oceanographic Institute, Woods Hole, MA QARTOD IV breakout sessions will address quality assurance (QA) procedures for the following four data parameters:
Los Angeles Southwest College - QARTOD - 3
Los Angeles Southwest College - QARTOD - 3
QARTOD-IIIWednesday, November 2, 2005, 8:30 AM NOONJohn OrcuttScripps Welcome/ORION SCCOOS Welcome Ocean.US status Eric TerrillGood time to discuss QAQC 38% of buoy data to NDBC now is from IOOS partners QAQC is an issue for NDBC SCCOOS Overv
Los Angeles Southwest College - CSCE - 790
Intrusion ControlFall 2001 CSCE 590CSCE 790 - Internet Security1ReadingsRequired: Maximum security: Ch 12 Recommended: Some of the links on http:/www.cse.sc.edu/ research/isl/CSCE 790 - Internet Security2Historical Research Prevention
Los Angeles Southwest College - CSCE - 548
CSCE 548 Code ReviewReading Thislecture: McGraw: Chapter 4 Recommended:Best Practices for Peer Code Review, http:/www.smartbear.com/docs/BestPracticesForPeerCodeReview.pdfWorst Practices in Developing Secure Software, http:/www.infosec
Los Angeles Southwest College - CSCE - 824
An Example of Economical Modeling Using AgentsRecommender Systems: A Marked-Based DesignYan Zheng Wei, Luc Moreau, Nicholas R. Jennings Proc. 2nd International Joint Conference on Autonomous Agents and Multi Agent Systems (AAMAS03)Presented by Be
Los Angeles Southwest College - CSCE - 548
CSCE 548 Secure Software DevelopmentRisk-Based Security TestingReading This Nextlecture: lecture: Risk-Based Security Testing, McGraw: Chapter 7 Security Operations, McGraw: Chapter 9CSCE 548 - Farkas2Application of TouchpointsExtern
Los Angeles Southwest College - CSCE - 145
Career Fair Blitz, September 20, 2006, 11-2:00 @ Carolina ColiseumCompanies interested in Engineering & IT MajorsAs of 9/5/06Company Name Position(s)Major(s)CompE, CS, CIS CompE, CS, CIS CS, CIS CompE, CS, CIS, EE, ME IT Majors, ME IT Majors,
Los Angeles Southwest College - CSCE - 204
aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaks
Los Angeles Southwest College - CSCE - 204
aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaks
Los Angeles Southwest College - CSCE - 204
aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaks
Los Angeles Southwest College - CSCE - 145
CSCE 145: Test 1 Answers 1. RobotR2D2AttributesheadDirec t b tionbodyDirectionboxMeth odsR2D2findObiWanplay R f M Message2.1. public R2D2(City city, Direction dir) 2.2 arguments 3. 3 attributes 4. public void findObiWan(City aCity) 5. R2D2 arto
Los Angeles Southwest College - CSE - 352
EECE 352Problem Set #1Due: Tuesday September 1, 1998Fall 1998 Problem: In a cost-cutting frenzy, the University has decided to eliminate all their accounting staff and hired you to develop a system for keeping track of all pertinent information a
Los Angeles Southwest College - CSE - 352
EECE 352Problem Set # 10Due: November 17Fall 1998 Task 1 (50%): You will implement your own versions of both Shell sort and Quick Sort. Their signatures are: template <class Etype> void ShellSort( Etype A[ ], int N )/A is array template <class Et
Los Angeles Southwest College - CSE - 352
EECE 352Problem Set # 6Due: October 6Fall 1998 Problem: Like most people, you have become extremely annoyed with the MS Word spellchecker-especially the fact that it takes forever to spell check your favorite Russian novels. With your complete ma
Los Angeles Southwest College - CSE - 352
EECE 352Problem Set #2Due: September 8, 1998Fall 1998 Problem 1 (25%): Indicate for each pair of expressions (A,B) in the table below, whether A is O, , or of B. Assume that k 1, d > 0, m > 0, and b > 1 are constants. Your answer should fill ea
Los Angeles Southwest College - CSCE - 790
An example demonstrating:Creation and Initialization of an object from a file, using the CoGetInstanceFromFile API
Los Angeles Southwest College - CSCE - 790
=NOTE: Build these projects in the order shown below.===Inner (A component that implements an inner, reusable object.)= This component uses the [.\.\IDL\ocr.idl] file, so you need to build and register the OCRps.dll in that directory in
Los Angeles Southwest College - CSCE - 790
=NOTE: Build these projects in the order shown below.===IDL= This is the IDL file that supports the IThesaurus interface, an interface that is implemented by an outer object. The outer object (CoThesaurus) reuses the inner object, w