Write code in SAS that allows one to write to a csv file

Assignment Help Other Subject
Reference no: EM132492733

MAT013 Assignment -

1. Using R: In number theory, a polite number is a positive integer that can be written as the sum of two or more consecutive positive integers. Other positive integers are impolite.

Create a function that will give all impolite numbers less than kk (an input).

Demonstrate this function with k=70k=70.

Furthermore write another function which takes also as input the name of a file and writes polite numbers with their sum representations to a csv file with that name. Demonstrate this function with k=70k=70 and the file name "politenumbers.txt".

2. A perfect number is a natural number that is equal to the sum of its divisors (excluding itself). For example 1,2,4,71,2,4,7 and 1414 divide 2828 and 28=1+2+4+7+1428=1+2+4+7+14.

Write code in SAS that allows one to write to a csv file a data set with all natural numbers less than a given parameter NN as well as a boolean variable indicating if the number is perfect or not. For example, for N=6N=6 the csv file would contain the following:

1, False

2, False

3, False

4, False

5, False

6, True

3. Using R: Write a function that will return the nnth Fibonacci number, F(n)F(n).

Modify the function so that it returns the nnth number of the sequence defined by: K(0)K(1)K(n)=a=b=αK(n-1)+βK(n-2)K(0)=aK(1)=bK(n)=αK(n-1)+βK(n-2) where a,b,αa,b,α and ββ are input parameters.

Write another function so that it will write all numbers of the form K(n)K(n) less than some number kk to a csv file. The name of the csv file must not be an input parameter to the function but include the parameters a,b,αa,b,α and ββ as well as the date on which the code was run. For example: general_fib_a=2_b=3_alpha=10_beta=2_2020-04-24.csv.

4. Using R: Load the dataset Seatbelts from library datasets in R. The dataset has 192 observations of monthly data on the number of deaths and serious injuries in the UK, for some months before and after introducing the legislation for seatbelts. Each row represents a month and for each month we measured 8 variables including the number of car driver deaths (DriversKilled), the number of deaths and serious injuries (drivers), the number of deaths and serious injuries in the front seat (front), the number of deaths and serious injuries in the rear seat (rear), distance driven (kms), petrol price (PetrolPrice), number of van drivers killed (VanKilled) and whether the law was in effect or not that month (law). Open the help file in R to see more details for the dataset.

Create a histogram demonstrating the number of drivers that died or seriously injured in an accident and histograms for the people in the front and rear seats of the car that died or seriously injured.

Compute the average number of people in the front seat that die or seriously injured is different for the months that the law is not in effect and the months the law it is in effect.

What is the correlation between variables front and rear.

5. Suppose that we want to compute the integral

I=∫∞0f(x)p(x)dx, I=∫0∞f(x)p(x)dx,

where p(x)p(x) is the density of the Chi-Square distribution with df=3. Consider the sum

SN=1/N∑i=1Nf(zi),SN=1/N∑i=1Nf(zi),

where zi,i=1,...,N,zi,i=1,...,N, are independent identically distributed random variables with the standard lognormal distribution. By the Central Limit Theorem (CLT), we have SN→I as N→∞,SN→I as N→∞, Thus, SNSN is an estimator of II.

Consider the function f(x)=cos(x4)/(1+|x|)f(x)=cos(x4)/(1+|x|). Using R, write a function GetSN with argument NN which returns SNSN. Write a file with 40 evaluations of the function GetSN for N=5000N=5000. What can you say statistically about II?

Instructions - The outputs of this coursework will be: A written report in doc-, pdf- or html-format describing your code (SAS and R) and screenshots.  A file containing the required SAS code. Note that all operations needed to complete the coursework should be included in the SAS code. A file containing the required R code.

Attachment:- Assignment File - SAS and R.rar

Reference no: EM132492733

Questions Cloud

How the manipulation will affect the dependent variables : Developing a research hypothesis (also referred to as the test hypothesis or alternative hypothesis), and selecting participants to test the hypothesis.
What the term structure is said to be downward slopping : What the term structure is said to be downward slopping, upward slopping,flat, humped. If yields on long-term bonds are lower than the yields
Understand the temperament of children : It is important to understand the temperament of children in care because researchers believe that it is necessary to have a goodness of fit.
Explain the disadvantage of the survey method : Explain one advantage and one potential disadvantage of the survey method you proposed as it relates to your specific study idea.
Write code in SAS that allows one to write to a csv file : MAT013 Assignment - Write code in SAS that allows one to write to a csv file a data set with all natural numbers less than a given parameter NN
Do you believe that humans are basically good : Do you believe that humans are basically good or evil at their core?
Prepare firms closing entries for taylor maid services : Prepare the firm's closing entries for Taylor Maid Services on June 30, 2008. accounts were taken from the books of Taylor Maid Services
Discuss sexual health and substance abuse : What is the best way to discuss Sexual Health and Substance Abuse at the high school level?
What other factors could explain the findings : What other factors could explain their findings? What were some of the considerations or little things that the researchers took into account that strengthened.

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd