Statistics and Statistical Programming (Winter 2017)/R lecture outline: Week 4: Difference between revisions
From CommunityData
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
** if you to output something in the middle: you use the print() function | ** if you to output something in the middle: you use the print() function | ||
* doing simple simulations | * briefly covered: | ||
** distribution functions: lets focus on *unif(): the key is on page 222 of Verzani | |||
*** The “d” functions return the p.d.f. of the distribution | |||
**** dunif(x=1, min=0, max=3) # 1/3 of the area is the to the left 1 | |||
*** The “p” functions return the c.d.f. of the distribution. | |||
**** dunif(q=2, min=0, max=3) #1/(b-a) is 2/3 | |||
*** The “q” functions return the quantiles. | |||
**** qunif(p=0.5, min=0, max=3) # half way between 0 and 3 | |||
*** The “r” functions return random samples from a distribution. | |||
**** runif(n=1, min=0, max=3) # a random value in [0,3] | |||
* doing simple simulations with random data | |||
** runif() | ** runif() | ||
** rnorm() | ** rnorm() | ||
Line 17: | Line 28: | ||
* running quick simulations | * running quick simulations | ||
** lets look at the relationship between mean and standard deviation on a 1 through 10 likert scale | ** lets look at the relationship between mean and standard deviation on a 1 through 10 likert scale | ||
Line 22: | Line 34: | ||
* ordered() — really just a type of factor for ordinal data | * ordered() — really just a type of factor for ordinal data | ||
Revision as of 17:27, 26 January 2017
- keys stuff for building confidence intervals and p-values:
- compute a sample standard error just like we did in the book, but in R
- t.test() with one sample (build a confidence interval)
- two things I showed in class which are super useful:
- sort.list()
- complete.cases()
- doing something repeatedly:
- just define a function and then apply it to a list of things
- if you to output something in the middle: you use the print() function
- briefly covered:
- distribution functions: lets focus on *unif(): the key is on page 222 of Verzani
- The “d” functions return the p.d.f. of the distribution
- dunif(x=1, min=0, max=3) # 1/3 of the area is the to the left 1
- The “p” functions return the c.d.f. of the distribution.
- dunif(q=2, min=0, max=3) #1/(b-a) is 2/3
- The “q” functions return the quantiles.
- qunif(p=0.5, min=0, max=3) # half way between 0 and 3
- The “r” functions return random samples from a distribution.
- runif(n=1, min=0, max=3) # a random value in [0,3]
- The “d” functions return the p.d.f. of the distribution
- distribution functions: lets focus on *unif(): the key is on page 222 of Verzani
- doing simple simulations with random data
- runif()
- rnorm()
- running quick simulations
- lets look at the relationship between mean and standard deviation on a 1 through 10 likert scale
Skipped for now
- ordered() — really just a type of factor for ordinal data