Question

Completing regression modeling can require various steps in order to obtain the best results. The process...

Completing regression modeling can require various steps in order to obtain the best results. The process can involve creating a graph to illustrate the relationship between variables, determining best-fit lines, and also approximating or producing smooth-fit lines to represent the data. What are the necessary commands required to carry out such an analysis in R? Please provide an example to illustrate your assertions.

Homework Answers

Answer #1

Consider, the Rest program given below,

# Create the predictor and response variable.

x <- c(151, 174, 138, 186, 128, 136, 179, 163, 152, 131)

y <- c(63, 81, 56, 91, 47, 57, 76, 72, 62, 48)

relation <- lm(y~x)

# Give the chart file a name.

png(file = "linearregression.png")

# Plot the chart.

plot(y,x,col = "blue",main = "Height & Weight Regression",

abline(lm(x~y)),cex = 1.3,pch = 16,xlab = "Weight in Kg",ylab = "Height in cm")

# Save the file.

dev.off()

This will give you plot of x and y as given below and by observing this plot one can easily test the fit.

Thank you.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT