Rasmus Bååth
04/04/2014
y ~ 1 ett värde för alla datapunktery ~ x en linjär trend
lm använder sig av. mean och mmhttps://raw.githubusercontent.com/rpruim/ mosaicManip/master/R/mLineFit.R
library(mosaic)
# Copy-n-paste scriptet ovan in i terminalen/konsollen i R.
kids = fetchData("kidsfeet.csv")
mLineFit( length ~ width, data=kids )
![]()
library(mosaic)
kids = fetchData("kidsfeet.csv")
mLineFit( length ~ width, data=kids )
library(mosaic)
kids = fetchData("kidsfeet.csv")
fit1 <- lm(length ~ width, data=kids)
summary(fit1)
Call:
lm(formula = length ~ width, data = kids)
Residuals:
Min 1Q Median 3Q Max
-1.633 -1.037 0.230 0.713 1.964
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.817 2.938 3.34 0.0019 **
width 1.658 0.326 5.08 1.1e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.02 on 37 degrees of freedom
Multiple R-squared: 0.411, Adjusted R-squared: 0.395
F-statistic: 25.8 on 1 and 37 DF, p-value: 1.1e-05
En mer komplex modell kommer alltid ha högre R²
time ~ year*sex
…har alltid högre R² än…
time ~ year
y ~ x modell.cor-functionen.cor(length ~ width, data=kids)
[1] 0.6411
samples <- do(1000) * cor(length ~ width, data=resample(kids))
# Coverage interval
confint(samples, method="quantile")
name lower upper level method
1 result 0.4552 0.7833 0.95 quantile
# baserat på standard error
confint(samples, method="stderr")
name lower upper level method estimate margin.of.error
1 result 0.467 0.8047 0.95 stderr 0.6359 0.1689
Hone, L. S., & McCullough, M. E. (2012). 2D: 4D ratios predict hand grip strength (but not hand grip endurance) in men (but not in women). Evolution and Human Behavior, 33(6), 780-789.
2D:4D ratios were significant predictors of grip strngth for men (r = -0.35, 95% CI [-0.45, -0.05] ), but not for women (r = -0.15, 95% CI [-0.35, 0.05] ), suggesting that men (but not women) who had had more intrauterine exposure to testosterone were physically stronger than men who had had less intrauterine exposure to testosterone (see Fig. 1 and Fig. 2).
Modifierat från Hone, L. S., & McCullough, M. E. (2012). 2D: 4D ratios predict hand grip strength (but not hand grip endurance) in men (but not in women). Evolution and Human Behavior, 33(6), 780-789.