-1

Please show the loop of regression of each companies mean and max like this and report coefficients:

lm(colmean$MSFT~colmax$MSFT)
lm(colmean$AAPL~colmax$AAPL) 
lm(colmean$GOOGL~colmax$GOOGL)

Data:
> head(colmax)
      MSFT     AAPL   GOOGL
1 21.23999 5.201410  97.810
2 21.38546 6.096268 105.430
3 20.64884 6.019837  94.405

> head(colmean)
      MSFT     AAPL     GOOGL
1 21.11067 4.975767  94.04000
2 20.91273 5.663524  97.50684
3 20.05333 5.681336  90.57909

1 Answers1

0

You can try lapply, the final results will be in a list where each element is the fit for each column:

fit <- lapply(names(colmax), function(x){
    lm(colmean[[x]] ~ colmax[[x]])
})

or with mapply:

mapply(function(x, y) lm(y ~ x), colmax, colmean, SIMPLIFY = F)
mt1022
  • 16,834
  • 5
  • 48
  • 71