MATH 2311 Help Using R-Studio. To download R-Studio Go to the following link: and https://www.rstudio.com/products/rstudio/download3/

Slides:



Advertisements
Similar presentations
Data: Quantitative (Histogram, Stem & Leaf, Boxplots) versus Categorical (Bar or Pie Chart) Boxplots: 5 Number Summary, IQR, Outliers???, Comparisons.
Advertisements

Chapter 9: Simple Regression Continued
Inference for Regression
Regression Inferential Methods
Simple Linear Regression
Using R for Introductory Statistics CHAD BIRGER UNIVERSITY OF SIOUX FALLS.
Inference for Regression 1Section 13.3, Page 284.
© 2010 Pearson Prentice Hall. All rights reserved Least Squares Regression Models.
T-test.
Correlation and Regression. Correlation What type of relationship exists between the two variables and is the correlation significant? x y Cigarettes.
Simple Linear Regression Analysis
Chapter 9: Correlation and Regression
AP Stats Test Review  What are the four parts of the course? Inference, Experimental Design, Probability, and Data Analysis  How many multiple choice.
Formulas: Hypothesis test: We would like to know if there is . The data on six-year graduation rate (%), student-related expenditure per full-time.
10-Opening Picture of Probability and statistics 9.
A Statistical Analysis Example of A Full Functional Utilization of An Engineering Calculator Li-Fei Huang Dept. of App. Statistics.
Inference for Regression Find your notes from last week, Put # of beers in L1 and BAC in L2, then find LinReg(ax+b)
BPS - 3rd Ed. Chapter 211 Inference for Regression.
Section Copyright © 2014, 2012, 2010 Pearson Education, Inc. Lecture Slides Elementary Statistics Twelfth Edition and the Triola Statistics Series.
+ Chapter 12: Inference for Regression Inference for Linear Regression.
Regression. Height Weight Suppose you took many samples of the same size from this population & calculated the LSRL for each. Using the slope from each.
Stats/Methods I JEOPARDY. Jeopardy CorrelationRegressionZ-ScoresProbabilitySurprise $100 $200$200 $300 $500 $400 $300 $400 $300 $400 $500 $400.
Midterm Review! Unit I (Chapter 1-6) – Exploring Data Unit II (Chapters 7-10) - Regression Unit III (Chapters 11-13) - Experiments Unit IV (Chapters 14-17)
Wednesday, May 13, 2015 Report at 11:30 to Prairieview.
Elementary Statistics Correlation and Regression.
Regression with Inference Notes: Page 231. Height Weight Suppose you took many samples of the same size from this population & calculated the LSRL for.
Inference for Regression Chapter 14. Linear Regression We can use least squares regression to estimate the linear relationship between two quantitative.
STA 286 week 131 Inference for the Regression Coefficient Recall, b 0 and b 1 are the estimates of the slope β 1 and intercept β 0 of population regression.
3.2 - Least- Squares Regression. Where else have we seen “residuals?” Sx = data point - mean (observed - predicted) z-scores = observed - expected * note.
1 Regression Analysis The contents in this chapter are from Chapters of the textbook. The cntry15.sav data will be used. The data collected 15 countries’
Statistics: Unlocking the Power of Data Lock 5 Exam 2 Review STAT 101 Dr. Kari Lock Morgan 11/13/12 Review of Chapters 5-9.
Review Lecture 51 Tue, Dec 13, Chapter 1 Sections 1.1 – 1.4. Sections 1.1 – 1.4. Be familiar with the language and principles of hypothesis testing.
Essential Statistics Chapter 51 Least Squares Regression Line u Regression line equation: y = a + bx ^ –x is the value of the explanatory variable –“y-hat”
Chapter 10 Inference for Regression
The Practice of Statistics, 5th Edition Starnes, Tabor, Yates, Moore Bedford Freeman Worth Publishers CHAPTER 12 More About Regression 12.1 Inference for.
MATH 2311 Help Using R-Studio. To download R-Studio Go to the following link: Follow the instructions for your computer.
Course Review. Distributions What are the important aspects needed to describe a distribution of one variable? List three types of graphs that could be.
Lesson Testing the Significance of the Least Squares Regression Model.
Correlation and Regression Elementary Statistics Larson Farber Chapter 9 Hours of Training Accidents.
AP Stats Review day 1 April 2, Basics Two Parts (90 Minutes each part) – 40 Multiple Choice Content Questions (10-15) Calculation Questions(25-30)
BPS - 5th Ed. Chapter 231 Inference for Regression.
Chapter 12: Correlation and Linear Regression 1.
AP Statistics Review Day 1 Chapters 1-4. AP Exam Exploring Data accounts for 20%-30% of the material covered on the AP Exam. “Exploratory analysis of.
Marginal Distribution Conditional Distribution. Side by Side Bar Graph Segmented Bar Graph Dotplot Stemplot Histogram.
The Practice of Statistics, 5th Edition Starnes, Tabor, Yates, Moore Bedford Freeman Worth Publishers CHAPTER 12 More About Regression 12.1 Inference for.
We will use the 2012 AP Grade Conversion Chart for Saturday’s Mock Exam.
Week 2 Normal Distributions, Scatter Plots, Regression and Random.
Regression Inference. Height Weight How much would an adult male weigh if he were 5 feet tall? He could weigh varying amounts (in other words, there is.
Midterm Review IN CLASS. Chapter 1: The Art and Science of Data 1.Recognize individuals and variables in a statistical study. 2.Distinguish between categorical.
Thursday, May 12, 2016 Report at 11:30 to Prairieview
Ready for the AP Test?.
Math 21 Midterm Review Part 1: Chapters 1-4.
Inference for Regression (Chapter 14) A.P. Stats Review Topic #3
STAT 4030 – Programming in R STATISTICS MODULE: Basic Data Analysis
Review 1. Describing variables.
AP Stat Review Know Your Book!
Inference for Regression
MATH 2311 Section 1.5.
HMI 7530– Programming in R STATISTICS MODULE: Basic Data Analysis
Inference in Linear Models
CHAPTER 12 More About Regression
Scatter Plots and Least-Squares Lines
Part I Review Highlights, Chap 1, 2
Ch 4.1 & 4.2 Two dimensions concept
Normal Distribution The Bell Curve.
@pbrucemaths Read the paper, annotate questions Check your answers!
Inference for Regression
Introductory Statistics
MATH 2311 Section 5.3.
MATH 2311 Section 1.5.
Presentation transcript:

MATH 2311 Help Using R-Studio

To download R-Studio Go to the following link: and Follow the instructions for your computer operating system.

Basic Commands: Assign a data set to a variable: Type the following: assign(“x”,c(2,3,4,5)) This will assign the list: 2, 3, 4, 5 to the variable x.

Basic Commands: Assign a data set to a variable (method 2) Type the following: x<-c(2,3,4,5) This will assign the list: 2, 3, 4, 5 to the variable x.

Calculating Mean, Median, and Standard Deviation Once a list is assigned to variable, you can easily calculate mean, median and standard deviation: mean(x)min(x) median(x)max(x) sort(x) sd(x)length(x) How many elements fivenum(x) Gives Min, Q1, Median, Q3, and Max

Try it out! Calculate the mean, median, and standard deviation of the following: 4, 6, 10, 11, 13, 15, 16, 20

Graphs in R-Studio Histograms: hist(x) Boxplots: boxplot(x) Dot Plot: dotchart(x) Stem and Leaf: stem(x) Pie Chart: pie(x)

Probability Distributions To enter a Random Variable: assign(“x”,c(1,2,3,4,5)) assign(“p”,c(0.5,0.3,0.1,0.05,0.05) Where p(1)=0.5, etc. For the mean:sum(x*p) For the variance:sum((x-mean)^2*p)

Binomial Distributions For an exact value: dbinom(x,n,p) For cumulative values: x=0,1,2,…q pbinom(q,n,p)

Geometric Distributions For an exact value: dgeom(n-1,p) For cumulative values: x=0,1,2,…q pgeom(n-1,p)

Hypergeometric Distribution For an exact value: dhyper(success, possible success, sample size, selection) For successes going from 0 through highsuccess: phyper(highsuccess, possible success, sample size, selection)

Normal Distributions: pnorm(z) will return the probability of obtaining less than a z-score of z. pnorm(x,mu,sigma) will return a probability of obtaining less than x with a mean of mu and standard deviation of sigma (standardization is not required).

Inverse Normal Distributions qnorm(p) will return the z score associated with a given probability (left tail). qnorm(p,mu,sigma) will return the x-value associated with a given probability for a mean of mu and a standard deviation of sigma (left tail).

Creating Scatterplots Once you have assigned lists “x” and “y” for the explanatory and response variables: plot(x,y) To determine the correlation coefficient: cor(x,y) To determine the coefficient of determination: cor(x,y)^2

Regression Lines: LSRL After data is inputted as lists “x” and “y” View the scatterplot: plot(x,y) Define the LSRL: Name=lm(y~x) View information on LSRL: Name This will identify the slope and y-intercept which you must place into y=mx+b for the equation of the line. See the graph of LSRL with scatterplot: abline(Name)

Residuals: To calculate a Residual: > - (LSRL with x-value substituted) Residual Plots: Residual = > - ( >* > + >) plot( >,Residual)

Non-Linear Regressions: If the Response List is defined as “y” and the Explanatory List is defined as “x” For a Quadratic Regression: sqrtY=sqrt(y) plot(x,sqrtY) For Logarithmic Regression: expY=exp(y) plot(x,expY) For Exponential Regression: logY=log(Y) plot(x,logY)

Calculating the z* value: Use qnorm(1.##/2) For example, for a confidence interval of 95%, z* = qnorm(1.95/2)

Calculating a t* value: Use qt(1.##/2,df) For example, for a confidence interval of 95% with 12 degrees of freedom: qt(1.95/2,12)

Calculating a p-value (Decision-Making) If you are using a z-test: Left Rejection Region: pnorm(z-value) Right Rejection Region: 1-pnorm(z-value) Two-sides Rejection Region: 2*pnorm(z-value) {z must be negative} If you are using a t-test: Left Rejection Region: pt(t-value,df) Right Rejection Region: 1-p (t-value,df) Two-sides Rejection Region: 2*pt(t-value,df) {t must be negative}

Chi Squared Tests: assign(“observed”,c(list)) assign(“expected”,c(list)) This is probability * total value (observed-expected)^2/expected sum((observed-expected)^2/expected) 1-pchisq(previous line, df)df=categories – 1