In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the example analysis of the results of lm () multiple regression analysis, which is very detailed and has a certain reference value. Interested friends must read it!
Interpretation of the results of multiple regression Analysis of lm ()
Now there are a number of data from meteorological stations. A certain study wants to look at the relationship between temperature and elevation, longitude and latitude. In fact, the focus is on the change of temperature with elevation (called temperature lapse rate in academic circles). The specific application requirement is to establish a linear model of temperature, elevation, longitude and latitude, and calculate the F statistics and the corresponding p value of the model.
The data is stored in a data.frame called myData. The first few columns of the data are as follows:
ID X Y Ele Temp1 50353 126.6333 51.73333 173.9 0.0550242 50468 127.4500 50.25000 166.4 1.6190743 50564 127.3500 49.43333 234.5 1.4689174 50674 129.4333 48.56667 404.5 0.9543245 50774 128.8333 47.70000 264.8 2.6212726 50778 132.5333 47.66667 57.5 4.410369
The linear relationship between Temp and Ele, X, Y is required:
MyModel = lm (Temp ~ Ele + X + Y, data = myData) summary (myModel) Call:lm (formula = Temp ~ Ele + X + Y, data = myData) Residuals: Min 1Q Median 3Q Max-1.00352-0.32245-0.01634 0.39690 1.27065 Coefficients: Estimate Std. Error t value Pr (> | t |) (Intercept) 27.8974176 5.0653852 5.507 3.76e-06Ele-0.0053912 0.0005171-10.425 3.97e-12X 0.1243715 0.0423171 2.939 0.00588Y-0.8286338 0.0377717-21.938
< 2e-16 (Intercept) ***Ele ***X ** Y ***---Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1Residual standard error: 0.5099 on 34 degrees of freedomMultiple R-squared: 0.9383, Adjusted R-squared: 0.9328 F-statistic: 172.3 on 3 and 34 DF, p-value: < 2.2e-16 mySummary = summary(myModel) mySummary[1]或mySummary$call:模型公式 mySummary[3]或mySummary$residuals:模型预测的残差 mySummary[4]或mySummary$coefficient:模型截距,每个变量系数、计算误差、t-value、pr(>T), put in a list, and can be extracted on demand
MySummary [6] or mySummary$sigma:residual standard error
MySummary [7] or mySummary$df: degrees of freedom
MySummary [8] or mySummary$r.squared:R squared
MySummary [9] or mySummary$adj.r.squared: adjust R squared
MySummary [10] or mySummary$fstatistic:F statistics & a numerator and a denominator, also put in list, can be extracted on demand
MySummary [11] or mySummarycov.unscaled: correlation coefficient matrix of variables
MySummary [11].: NA
At this time, you will find that the last p-value is missing. It is calculated according to several values in mySummary$fstatistic.
F = mySummary$fstatisticp_value = pf (as.numeric (f [1]), as.numeric (f [2]), as.numeric (f [3]), lower.tail = FALSE)
*
Continue the problem of temperature lapse rate
Lapse_rates = coef (myModel) [2] f = summary (myModel) $fstatisticf_statistic = f [1] p_value = pf (as.numeric (f [1]), as.numeric (f [2]), as.numeric (f [3]), lower.tail = FALSE) result = c (lapse_rates,f_statistic, p_value) names (result) = c ("lapse_rates", "F-statistic") "p-value") print (result) lapse_rates F-statistic p-value-5.391219e-03 1.723034e+02 1.261248e-20 are all the contents of the article "sample Analysis of the results of lm () multiple regression Analysis" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.