Velocity
(숫자), Height
(숫자), Gender
(범주 형)의 데이터 프레임 PlotData_df
이 있습니다.그룹화 된 데이터에 대한 회귀 방정식을 내보내는 방법은 무엇입니까?
c <- lm(Height ~ Velocity, data = PlotData_df)
summary(c)
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) 4.1283 1.0822 3.815 0.00513 **
# Velocity -0.3240 0.2854 -1.135 0.28915
# Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# Residual standard error: 0.4389 on 8 degrees of freedom
# Multiple R-squared: 0.1387, Adjusted R-squared: 0.03108
# F-statistic: 1.289 on 1 and 8 DF, p-value: 0.2892
a <- signif(coef(c)[1], digits = 2)
b <- signif(coef(c)[2], digits = 2)
Regression <- paste0("Velocity = ",b," * Height + ",a)
print(Regression)
# [1] "Velocity = -0.32 * Height + 4.13"
가 어떻게이 (성별은 남성 또는 여성인지에 따라)이 회귀 방정식을 표시하기 위해 확장 할 수
Velocity Height Gender
1 4.1 3.0 Male
2 3.1 4.0 Female
3 3.9 2.4 Female
4 4.6 2.8 Male
5 4.1 3.3 Female
6 3.1 3.2 Female
7 3.7 3.0 Male
8 3.6 2.4 Male
9 3.2 2.7 Female
10 4.2 2.5 Male
는 내가이 완료 데이터를 회귀 방정식을 제공하기 위해 다음과 같은 사용?