简体   繁体   中英

Linear regression with infinite slope

I know how to perform simple linear regression in R but how to perform the regression with infinite slope (see an example with same dataset from excel) with R1 on x-axis and LAI1 on the y-axis.

   R1 LAI1 
233.7 1.34 
411.3 4.42 
143.4 3.57 
136.7 3.27 
249.0 5.53 
 59.0 1.79 
186.0 4.32 
185.0 2.58 

在此处输入图像描述

What do you mean with "infinite slope"? This is how you would do it in R:

library(dplyr)
df <- tibble::tribble(
    ~R1, ~LAI1,
  233.7,  1.34,
  411.3,  4.42,
  143.4,  3.57,
  136.7,  3.27,
    249,  5.53,
     59,  1.79,
    186,  4.32,
    185,  2.58
  )


model1 <- lm(LAI1 ~ R1, data = df)
summary(model1)

plot(df$R1, df$LAI1)
abline(model1)

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM