3
Rの因子による線形回帰
Rで因子がどのように機能するかを理解しようとしています。Rのサンプルデータを使用して回帰を実行するとします。 > data(CO2) > colnames(CO2) [1] "Plant" "Type" "Treatment" "conc" "uptake" > levels(CO2$Type) [1] "Quebec" "Mississippi" > levels(CO2$Treatment) [1] "nonchilled" "chilled" > lm(uptake ~ Type + Treatment, data = CO2) Call: lm(formula = uptake ~ Type + Treatment, data = CO2) Coefficients: (Intercept) TypeMississippi Treatmentchilled 36.97 -12.66 -6.86 私はそれを理解しTypeMississippi、Treatmentchilledブール値として扱われます。各行の最初の取り込みは36.97で12.66あり6.86、それがミシシッピ型であるかどうか、および冷却されているかどうかを差し引きます。私はこのようなものを理解するのに苦労しています: > …