Home » How to Calculate Point Estimates in R (With Examples)

How to Calculate Point Estimates in R (With Examples)

by Tutor Aspire

A point estimate represents a number that we calculate from sample data to estimate some population parameter. This serves as our best possible estimate of what the true population parameter may be.

The following table shows the point estimate that we use to estimate population parameters:

Measurement Population parameter Point estimate
Mean μ (population mean) x (sample mean)
Proportion π (population proportion) p (sample proportion)

The following examples explain how to calculate point estimates for a population mean and a population proportion in R.

Example 1: Point Estimate of Population Mean

Suppose we would like to estimate the mean height (in inches) of a certain type of plant in a certain field. We gather a simple random sample of 13 plants and measure the height of each plant.

The following code shows how to calculate the sample mean:

#define data
data #calculate sample mean
mean(data, na.rm = TRUE)

[1] 15.61538

The sample mean is 15.6 inches. This represents our point estimate for the population mean.

We can also use the following code to calculate a 95% confidence interval for the population mean:

#find sample size, sample mean, and sample standard deviation
n rm = TRUE)
s #calculate margin of error
margin #calculate lower and upper bounds of confidence interval
low high high

[1] 19.19502

The 95% confidence interval for the population mean is [12.0, 19.2] inches.

Example 2: Point Estimate of Population Proportion

Suppose we would like to estimate the proportion of people in a certain city that support a certain law. We survey a simple random sample of 20 citizens.

The following code shows how to calculate the sample proportion:

#define data
data #find total sample size
n #find number who responded 'Yes'
k Y') 

#find sample proportion
p 

The sample proportion of citizens who support the law is 0.6. This represents our point estimate for the population proportion.

We can also use the following code to calculate a 95% confidence interval for the population mean:

#find total sample size
n #find number who responded 'Yes'
k Y') 

#find sample proportion
p #calculate margin of error
margin #calculate lower and upper bounds of confidence interval
low 

The 95% confidence interval for the population proportion is [0.39, 0.81].

Additional Resources

How to Calculate Five Number Summary in R
How to Find Confidence Intervals in R
How to Plot a Confidence Interval in R

You may also like