Question: Linear models are not necessarily linear with respect to their random variable arguments! Simulate small dataset with two dependent variables x,y, and with built-in linear
Linear models are not necessarily linear with respect to their random variable arguments! Simulate small dataset with two dependent variables x,y, and with built-in linear and quadratic terms in the dependency of y on x. Make sure you build the dependency in statistical sense, e.g. there is some noise in the data. Fit to these data models with 1) intercept, 2) intercept and slope, 3) intercept, slope and curvature (quadratic term x^2). Assess the performance of these models when fitting your dataset (Hints: x=1:20; y= 20+10*1:20+5*(1:20)^2+ rnorm(20,0,200) would simulate such dataset; fit a model on such pair of variables see how well it fits, how well it recovers the "true" parameters you built your simulated data with, try modifying the model as in 1)-->2)-->3) above, also assess effects of changing variance of the error term you built in into x,y).
USE R
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
