Piotr Bialas  Introductory Statistics with R

  • Welcome
  • Histogram 1
    • Histogram 2
    • How to Create a Histogram in R?
    • Histogram 3
  • Chapter 0
    • Chapter 1
    • Chapter 2.1
    • Chapter 2.2
    • Chapter 2.3
    • Chapter 2.4
  • Assignments
    • Extra Credit 1
  • Binomial Distr.
  • StandardND
  • Welcome
  • Histogram 1
    • Histogram 2
    • How to Create a Histogram in R?
    • Histogram 3
  • Chapter 0
    • Chapter 1
    • Chapter 2.1
    • Chapter 2.2
    • Chapter 2.3
    • Chapter 2.4
  • Assignments
    • Extra Credit 1
  • Binomial Distr.
  • StandardND

Chapter 1

Basic Operations on Real Numbers

Addition, Subtraction, Multiplication, and Division of Real Numbers

Examples (Open R/RStudio and type into Console)

3+5

3-5

3.25*4.125

15/3

# three raised to fourth power can be evaluated as:

3^4

# Square root operation: square root of 16 can be evaluated as

sqrt(16)

Scientific-Like Notation in R

# 1250 can be displayed in R as 1.25e+3: justification: 1.25*10^3=1.25*1000 
# 0.000125 can be displayed in R as 1.25e-4; while using the following 1.25*10^(-4) calculation by hand.

Use R or RStudio for exercises listed below:

Evaluate expression and round each to the nearest hundredth:

\[ \frac{179.5-173}{2.9} \]

\[ \frac{179.5-180}{\frac{2.8}{\sqrt{40}}} \]

\[ \frac{(1-10)^2+(4-10)^2+(11-10)^2+(13-10)^2}{4-1} \]

Convert to percent

\[ \frac{3}{8} \]
\[ 0.2345 \]

Evaluate the following standarized z scores:

\[ z_{1}=\frac{145-175}{6}= \] \[ z_{2}=\frac{236-175}{6}= \] \[ z_{3}=\frac{183-175}{6}= \] \[ z_{4}=\frac{145-175}{6}= \]

Here is your R syntax followed by numerical answer:

(247-175)/6
## [1] 12
(236-175)/6
## [1] 10.16667
(183-175)/6
## [1] 1.333333
(145-175)/6
## [1] -5

Calculate above z-scores at once by using the following syntax

x <-c(247,236,183,145)
mean <-175
sd <-6
(x-mean)/sd
## [1] 12.000000 10.166667  1.333333 -5.000000
Powered by Create your own unique website with customizable templates.