这个作业是用R语言分析统计即将毕业学生的平均薪资

Homework 1
1.开发办公室和注册商为您提供了以下内容的匿名匹配:
为108名即将毕业的经济学专业的学生提供起薪和GPA。您的样本包含一个
从教堂牧师到股票经纪人,各种各样的工作。
(a)108名学生的平均起薪为$ 38,644.86,有标准差
$ 7,541.40。为所有经济学的起薪点建立95%的置信区间
您的大学/学院的专业。
(b)心理学专业的类似样本表明起薪明显较低。
鉴于这些学生受过相同的教育,这是否表明
就业市场上对心理学专业的歧视?
(c)您想知道通过计算经济学的平均薪水来获得好成绩是否值得
累积GPA达到B +或以上的专业,以及B或
更差。数据如下表所示。
累积GPA平均收益标准偏差n
B +或更高$ 39,915.25 $ 8,330.21 59
B或更差$ 37,083.33 $ 6,174.86 49
对以下假设进行t检验:在该假设中,两个起薪点是相同的。
人口。
2.考虑以下总体均值的替代估计量:
=(Y1 + Y2 + Y3 + Y4 + … + Yn–1 + Yn)
与相比,证明这是公正且一致的,但效率不高。
3.新闻杂志《经济学人》定期发布有关所谓的巨无霸指数的数据
和国家之间的汇率。 2000年4月29日发行的30个国家/地区的数据是
列在下面(数据集也作为.xlsx文件发布在Carmen上):
实际汇率价格
国家货币美元巨无霸

印尼盾14,500 7,945
意大利里拉4,500 2,088
韩国韩元3,000 1,108
智利比索1,260 514
西班牙比塞塔375179
匈牙利福林339279
日元294106
新台币70 30.6
泰国泰铢55 38.0
捷克共和国王冠54.37 39.1
俄罗斯卢布39.50 28.5
丹麦皇冠24.75 8.04
瑞典王冠24.0 8.84
墨西哥比索20.9 9.41
法国法郎18.5 .07
以色列谢克尔14.5 4.05
人民币9.90 8.28
南非兰特9.0 6.72
瑞士法郎5.90 1.70
波兰兹罗提5.50 4.30
德国马克4.99 2.11
马来西亚元4.52 3.80
新西兰元3.40 2.01
新加坡元3.20 1.70
巴西雷亚尔2.95 1.79
加元2.85 1.47
澳大利亚元2.59 1.68
阿根廷比索2.50 1.00
英镑1.90 0.63
美元2.51
购买力平价或PPP的概念(“
以相同货币表示的商品价格应相同。” Abel,A.和B. Bernanke,
宏观经济学,第四版,波士顿:Addison Wesley,476)表明
Mac以当地货币定价为美元价格应等于之间的汇率
两国。
(a)将BigMac.xlsx数据导入RStudio。计算每个美国的预测汇率
美元,将巨无霸以当地货币计的价格除以巨无霸的美国价格
(2.51美元)。也就是说,将一个变量添加到名为PredictedExRt的数据框中,该变量等于
BigMac价格除以2.51
(b)对实际汇率与预计汇率进行回归。如果购买
持有的力量平价,您对回归的斜率和截距有何期望
是?斜率和截距的值是否与您期望的值“相隔”
保持购买力平价? (提示:如果PPP成立,则意味着ForecastExRt应该接近
与ExchRate相同或完全相关)
(c)将实际汇率与预计汇率作图。包括45度
使用abline()命令在图中绘制一条直线。哪些观测值可能导致坡度
并且截距不同于零和一?
(d)陈述PPP所依据的两个零假设。您应该使用单尾还是双尾替代假设?
(e)截距和斜率的t统计量是多少?
(f)使用5%的显着性水平,您对给定的原假设作出何决定?
t统计量?您使用了哪些关键值?您是否担心以下事实?
您应该在假设成立时依次测试这两个假设
同时?
(g)使用学生的t分布必须做出哪些假设?
4. Use the data set called lead_mortality for this question (Read the description file first so you
know the variables). Import the file lead_mortality.xlsx into RStudio with name ‘leadmort’.
a. Write the R code that will provide the correlation matrix for all numerical variables. That
is the correlation between every numerical variable in the data set. Make sure not to
include the character variables (city and state) in this function.
b. Using your code in part (a) determine the variables that have highest and lowest
correlation with infant mortality rate.
c. Write the code to plot the scatter-plot of age against infant mortality. What does this
graph tell us? Does it make sense?
d. Do the same scatter plot in part (c) only for Ohio. Does the Graph for Ohio look similar
to the whole U.S? Explain. (Your answer should include both the code and the graphs as
well as your explanation)
e. Run the regression to see the effect of lead on infant mortality:
??????? = ?଴ + ?ଵ???? + ?
What is your estimate for intercept and sloe and their standard errors?
f. How do we test the hypothesis at 95% that lead causes infant mortality? What is your tstat? Given the t-stat do we have evidence that lead has effect on infant mortality?
g. Run the same regression for Ohio only and explain your results.
h. How many observations do we have for Ohio? What do you think about the validity of
the analysis in part (g) for Ohio?