简体   繁体   English

如何用 R 估计指数 function 的参数?

[英]How to estimate parameters of exponential function with R?

I am working on an investigation on ichthyofauna (study of fishes).我正在对 ichthyofauna(鱼类研究)进行调查。 I need to find the condition factor of the fish.我需要找到鱼的条件因素。 The steps to find the condition factor are as follows:查找条件因子的步骤如下:

1. W = aL^b... (1) 1. W = aL^b... (1)

Where:在哪里:

  • W: The weight of fish in grams. W:鱼的重量,以克为单位。
  • L: Total length of fish in centimeters. L:鱼的总长度,以厘米为单位。
  • a: Exponent describing the rate of change of weight with length (= the intercept of the regression line on the Y axis). a:描述重量随长度变化率的指数(= Y 轴上回归线的截距)。
  • b: The slope of the regression line (also referred to as the Allometric coefficient). b:回归线的斜率(也称为异速生长系数)。

2. Log w = log a + b log L... (2) 2. Log w = log a + b log L... (2)

Where:在哪里:

  • a: constant一:常数
  • b: the regression co-efficient b:回归系数

3. K = 100 w/L^b... (3) 3. K = 100 w/L^b... (3)

Where:在哪里:

  • W: Weight of the fish in grams W:鱼的重量,以克为单位
  • L: The total length of the fish in centimeters L:鱼的总长度,以厘米为单位
  • b: The value obtained from the length-eight equation formula b:从长度八方程公式得到的值

I understand that to calculate K, I must first obtain the regression slope (b of 1), then the co-efficient regression (b of 2) and finally K. I need help to do it in R.我知道要计算 K,我必须首先获得回归斜率(1 的 b),然后是系数回归(2 的 b),最后是 K。我需要在 R 中获得帮助。 I would be very grateful for your support.我将非常感谢您的支持。 Thanks and regards!谢谢并恭祝安康!

so for a very simple regression, you may want to start with a linear model, and you'd do something like this:所以对于一个非常简单的回归,你可能想从线性 model 开始,你会做这样的事情:

reg1 <- lm(log(W) ~ log(L), data=yourdataframename)

then check the summary for coefficients:然后检查系数的摘要:

summary(reg1)

Note you don't need to take a log of the intercept because it is a column of ones essentially (but it is included implicitly unless you put '-1' in your parameters)请注意,您不需要记录截距,因为它本质上是一列(但除非您在参数中输入“-1”,否则它会被隐式包含)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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