Posted on Categories:Regression Analysis, 回归分析, 统计代写, 统计代考

# 统计代写|回归分析代写Regression Analysis代考|Comparing Transformations of $X$ with the Car Sales Data

avatest™

## avatest™帮您通过考试

avatest™的各个学科专家已帮了学生顺利通过达上千场考试。我们保证您快速准时完成各时长和类型的考试，包括in class、take home、online、proctor。写手整理各样的资源来或按照您学校的资料教您，创造模拟试题，提供所有的问题例子，以保证您在真实考试中取得的通过率是85%以上。如果您有即将到来的每周、季考、期中或期末考试，我们都能帮助您！

•最快12小时交付

•200+ 英语母语导师

•70分以下全额退款

## 统计代写|回归分析代写Regression Analysis代考|Comparing Transformations of $X$ with the Car Sales Data

Consider the Car Sales data discussed in Chapter 4. The test for curvature using the quadratic function showed “significant” curvature, corroborating both the curved LOESS smooth, and the subject matter theory, which suggests that as interest rates increase, the mean sales function should flatten because cash sales are not affected by interest rates.
So, first of all, why bother transforming $X=$ Interest Rate? We already showed two different estimates of curvature, one using LOESS, and the other using the quadratic function. Why not use either the LOESS fit or the quadratic model? You could. But there are compelling reasons not to use either LOESS or quadratic models when you have curvature. These reasons are also compelling reasons for why you might wish to use a transformation to model curvature.
Problems with LOESS fit
The LOESS function cannot be written in a simple function such as linear, quadratic, exponential, etc. Having a simple function form such as $\mathrm{E}(Y \mid X=x)=\beta_0+\beta_1 \ln (x)$ makes the model easier to interpret and use.
Problems with quadratic models
Quadratics and higher-order polynomial functions are notoriously bad at the extreme low and high values of the $X$ data. In addition, quadratic models have an extra parameter $\left(\beta_2\right)$ that must be estimated, which can cause loss of accuracy.

Just because a model has a higher maximized likelihood $(L)$ than another model does not validate the model assumptions. In the case of the classical model, higher $L$ means that the $Y$ data have a smaller sum of squared deviations from the fitted function, but not that the assumptions of the model are valid. You still need to evaluate the assumptions of the transformed model, even when the model has a relatively high likelihood.
Checking the assumptions of the transformed model
To check assumptions of the model when you transform $X$, simply apply the techniques you learned in the previous chapter with the transformed $X$ variable. In other words, let $U=f(X)$ and check the assumptions of the $(U, Y)$ data in the same way that you check the assumptions with the $(X, Y)$ data.

## 统计代写|回归分析代写Regression Analysis代考|The Car Sales Data $\left(t, e_t\right)$ and $\left(e_{t-1}, e_t\right)$ Plots

The Car Sales data are pure time-series since the data are collected in 120 consecutive months. The following code shows the relevant plots to check for uncorrelated (specifically, non-autocorrelated) errors.
URA-DataSets/master/Cars.txt”)
attach(CarS); $\mathrm{n}=$ nrow(CarS)
fit $=$ lm(NSOLD $~$ INTRATE)
resid $=$ fit\$residuals par(mfrow=c(1,2)) plot($1: n$, resid, xlab=”month”, ylab=”residual”) points($1: n$, resid, type=”l”); abline(h=0) lag.resid = c(NA, resid[1:n-1]) plot(lag.resid, resid, xlab=”lagged residual”, ylab= “residual”) abline(lsfit(lag.resid, resid)) Cars$=$read.table$($“https://raw.githubusercontent. com/andrea$2719 /$URA-DataSets/master/Cars.txt”) attach (Cars);$n=\operatorname{nrow}(\operatorname{Cars})\mathrm{fit}=\operatorname{lm}(\mathrm{NSOLD} \sim$INTRATE$)$resid$=$fit\$residuals
par (mfrow=c $(1,2))$
plot ( $1: n$, resid, $x l a b=$ “month”, ylab=”residual”)
points $(1: \mathrm{n}$, resid, type=”I”); abline $(\mathrm{h}=0)$
lag.resid $=c(N A, r e s i d[1: n-1])$
plot (lag.resid, resid, $x l a b=$ “lagged residual”, ylab = “residual”)
abline(lsfit (lag.resid, resid))
The results are shown in Figure 4.8. There is overwhelming evidence of autocorrelation shown by both plots.

What are the consequences of such an extreme violation of assumptions? According to the mathematical theorems summarized in Chapter 3 , if the data-generating process is truly given by the regression model, then the confidence intervals and $p$-values behave precisely as advertised, with precisely 95\% confidence, and precisely 5\% significance levels. When the independence assumption is grossly violated as seen here, the true confidence levels may be far from 95\% and the true significance levels may be far from 5\%. How far? You guessed it: You can find out by using simulation.

## 统计代写|回归分析代写Regression Analysis代考|The Car Sales Data $\left(t, e_t\right)$ and $\left(e_{t-1}, e_t\right)$ Plots

Car Sales数据是纯时间序列，因为数据是连续120个月收集的。下面的代码显示了检查不相关(特别是非自相关)错误的相关图。
CarS = read.table(“https://raw.githubusercontent.com/andrea2719/ .table “)
“URA-DataSets/master/Cars.txt”)
attach(CarS);$\mathrm{n}=$ nrow(CarS)
fit $=$ lm(NSOLD $~$ INTRATE)
Resid $=$ fit＄残差
par(mfrow=c(1,2))

abline(lsfit);残留，残留))

“URA-DataSets/master/Cars.txt”)

$\mathrm{fit}=\operatorname{lm}(\mathrm{NSOLD} \sim$ INTRATE $)$
Resid $=$ fit＄残差
Par (mfrow=c $(1,2))$

points $(1: \mathrm{n}$, resid, type=”I”);在线$(\mathrm{h}=0)$

Abline (lsfit (lag))残留，残留))

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。