- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find the point estimate using regression model in R?
To find the point estimate using regression model in R, we can follow the below steps −
- First of all, create a data frame.
- Then, create the regression model.
- After that, define the value for which we want to find the point estimate and use predict function to find the estimate.
Create the data frame
Let's create a data frame as shown below −
x1<-rnorm(20) y1<-rnorm(20) df<-data.frame(x1,y1) df
On executing, the above script generates the below output(this output will vary on your system due to randomization) −
x1 y1 1 0.53233256 -0.17433578 2 0.53362706 1.73778811 3 1.21038775 -1.02142344 4 -1.50504650 0.01770948 5 -0.55570505 0.91796585 6 1.01597916 0.88380869 7 0.21911440 1.34088517 8 1.21258700 1.14469629 9 -0.98170554 -1.04790911 10 -0.67748759 -1.16909492 11 0.00801995 -0.35320938 12 -1.04972030 1.35817346 13 -1.35385333 0.87222670 14 1.09276537 0.70046753 15 0.10064662 0.27685523 16 0.12231502 -0.26659197 17 0.83791912 -0.80416436 18 1.56681559 0.43084296 19 -1.13942633 1.19649376 20 0.84196501 0.28244014
Create the regression model
Using lm function to create the regression model between x1 and y1 −
x1<-rnorm(20) y1<-rnorm(20) df<-data.frame(x1,y1) Model<-lm(y1~x1) Model
Output
Call: lm(formula = y1 ~ x1) Coefficients: (Intercept) x1 0.317061 -0.008665
Find the point estimate
Using predict function to find the point estimate of y1 when x1 is 1.08 −
x1<-rnorm(20) y1<-rnorm(20) df<-data.frame(x1,y1) Model<-lm(y1~x1) new_data<-data.frame(x1=0.08) predict(Model,new_data)
Output
1 0.3163682
- Related Articles
- How to find the confidence interval for the predictive value using regression model in R?
- How to add title to regression model using stargazer in R?
- How to create polynomial regression model in R?
- How to find the standardized coefficients of a linear regression model in R?
- How to find the high leverage values for a regression model in R?
- How to find residual variance of a linear regression model in R?
- How to create an only interaction regression model in R?
- How to find the degrees of freedom of residual from a regression model in R?
- How to plot the confidence interval of the regression model using ggplot2 with transparency in R?
- How to remove interaction from regression model in stargazer in R?
- How to create regression model line in a scatterplot created by using ggplot2 in R?
- How to display regression slope using model in a plot created by ggplot2 in R?
- How to display regression intercept using model in a plot created by ggplot2 in R?
- How to display R-squared value on scatterplot with regression model line in R?
- How to extract the regression coefficients, standard error of coefficients, t scores, and p-values from a regression model in R?

Advertisements