Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5)Build a function my.ls() which performs the least square estimation for a continuous response variable y regressed on two predictors x1 which is a numeric

5)Build a function my.ls() which performs the least square estimation for a continuous response variable y regressed on two predictors x1 which is a numeric predictor and x2 which is a categorical predictor. You may assume that your model contains an intercept. Test the function on the ChickWeight dataset in R, where y is weight, x1 is Time (assumed to be continuous) and x2 is Diet, i.e., check if the function can reproduce the estimated beta coefficients from

data(ChickWeight) fit <- lm(ChickWeight$weight~ChickWeight$Time+ChickWeight$Diet) fit$coef

#using R, the code step by step so I learn

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Geometry And Analysis Of Fractals Hong Kong, December 2012

Authors: De Jun Feng, Ka Sing Lau

1st Edition

3662439204, 9783662439203

More Books

Students also viewed these Mathematics questions

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago