You are on page 1of 1

Assignment 1 (01 Sept 2023)

Course: Probability and Statistics with R Lab (AMMSCD505)


Instructor: Dr. Sushma Kumari, SoCE&MS, DIAT
Code in R with valid syntax to answer the following.
Q1. Write a code in R to create a sequence of numbers from 20 to 50 and find the mean of numbers from 20 to 30.

Q2. Suppose the surface area of a circle equals 25, what is the radius?

Q3. What is the probability density at x=0 of a normally distributed random variable x with mean (mu) equal to zero,
and standard deviation (sigma) equal to one?

Q4. Consider the following formula to calculate the number of payments

𝑖
ln (𝑀 + 1)
−𝑖
𝑛= 𝑃
ln(1 + 𝑖)

a. Calculate the number of payment terms n for a mortgage with a principle balance of 200,000, monthly
interest rate of 0.5%, and monthly payment amount of 2000.
b. Now construct a vector n of length 6 with the results of this calculation for a series of monthly payment
amounts: 2000, 1800, 1600, 1400, 1200, 1000.

Q5. Find out for whether the second number is a multiple of the first number
a. 530, 1429410
b. 77, 13960
c. 8, 391600

Q6. Convert the following multi-line operations to a single expression


a. w = u + v
w=w/2
w=w+u
b. w1 = u^3
w2 = u - v
w = w1 / w2

Q7. Use seq() and rep() to shorten the following


a. x = c(97, 98, 99, 100, 101, 102, 97, 98, 99, 100, 101, 102, 97, 98, 99, 100, 101, 102)
b. x = c(-5, -5, -5, -5, -6, -6, -6, -6, -7, -7, -7, -7, -8, -8, -8, -8)
c. x = c(13, 13, 17, 17, 21, 21, 25, 25, 29, 29, 13, 13, 17, 17, 21, 21, 25, 25, 29, 29)
d. x = c(1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0)

Q8. Create a vector of size 5 and use sort() and order() functions for arrangement of values of the entered vector.
Describe what does order() do and how it is different from sort().

You might also like