【Andrew Gelman Data Analysis Using Regression and Multilevel/Hierarchical Models】3.9 exercises 解答

本文提供了对Andrew Gelman书籍中数据分析练习的解答,涉及线性回归模型、假设检验、残差分析、预测及模型解释。通过模拟独立变量的回归分析,展示了统计独立情况下回归系数的显著性。同时,讨论了母亲年龄、教育水平对孩子测试成绩的影响,以及高中毕业状态的交互效应。此外,还分析了教师外貌与课程评价的关系。
摘要由CSDN通过智能技术生成

自己写的答案,希望各位多加批评指正

第一题

  1. The folder pyth contains outcome y and inputs x1, x2 for 40 data points, with a further 20 points with the inputs but no observed outcome. Save the file to your working directory and read it into R using the read.table() function.
    (a) Use R to fit a linear regression model predicting y from x1, x2, using the first 40 data points in the file. Summarize the inferences and check the fit of your model.
    (b) Display the estimated model graphically as in Figure 3.2.
    (c ) Make a residual plot for this model. Do the assumptions appear to be met?
    (d) Make predictions for the remaining 20 data points in the file. How confident do you feel about these predictions?

Gelman老师的数据已经找不到了,所以就还是用下午的数据吧:简单回归模型

第二题

  1. Suppose that, for a certain population, we can predict log earnings from log height as follows:
    • A person who is 66 inches tall is predicted to have earnings of $30,000.
    • Every increase of 1% in height corresponds to a predicted increase of 0.8% in earnings.
    • The earnings of approximately 95% of people fall within a factor of 1.1 of predicted values.
    (a) Give the equation of the regression line and the residual standard deviation of the regression.
    (b) Suppose the standard deviation of log heights is 5% in this population. What, then, is the R2 of the regression model described here?

(a)

回 归 方 程 : l o g ( e a r n i n g s ) = α + 0.8 l o g ( h e i g h t ) + μ 回归方程:log(earnings)=\alpha + 0.8log(height)+\mu log(earnings)=α+0.8log(height)+μ

将 e a r n i n g = 30000 , h e i g h t = 66 带 入 上 述 方 程 , 得 α = 6.957229 将earning=30000, height=66带入上述方程,得\alpha=6.957229 earning=30000,height=66α=6.957229

#计算\alpha的值
a <- log
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值