rlmmodel-fittinglinearmodels

How can I find two missing parameters in r using lm() function?


I was asking to find best fit values for two unknown parameters using the lm() function in r, I have used the lm function before but I am unsure of how to do this for unknown parameters?

I need to use the lm function on this formula

log⁡(C)~ log⁡(A)+ D log⁡(B)

Based off of this model

log(C)~ N(log⁡(A)+ D log⁡(B),σ^2 )

I already have the starting values for C and B in vectors, and I need to estimate A and D? I am not how to do this in r using the lm function.

Thank you!


Solution

  • To minimize the residual sum of squares, just use the lm function. Your output will contain an intercept and a coefficient associated with any predictor variables. Thus:

    lm(log(C) ~ log(B), data = my_data) 
    

    You will predict log(C) as a linear combination of two parameters: the estimate of the "intercept" and the regression coefficient of log(B). For your purposes, this is log(A) and D respectively.