Use of offset in lm regression - R

前端 未结 2 1076
难免孤独
难免孤独 2021-01-05 17:51

I have this code

dens <- read.table(\'DensPiu.csv\', header = FALSE)
fl <- read.table(\'FluxPiu.csv\', header = FALSE)
mydata <- data.frame(c(dens),         


        
2条回答
  •  鱼传尺愫
    2021-01-05 18:35

    Your offset term has to be a variable, like x and y, not a numeric constant. So you need to create a column in your dataset with the appropriate values.

    dat$o <- 283.56
    lm(y ~ I(x - x0) - 1, data=dat, offset=o)
    

提交回复
热议问题