for loop - Integrate over groups of variables -


i trying integrate quadratic linear function each individual within study system.

i have fit lm each individual , calculated intercept, linear coefficient , quadratic coefficient data set looks 75 individuals:

id.x  intercept       coeff1        coeff2 1     0.1683109    -0.005091914  3.850922e-05 45   -0.5147262     0.015340073  -1.142777e-04 

i integrate area under curve ((int+x*coeff1+i(x^2)*coeff2) lower=60.1 upper=70.37) each individual.

i have tried using integrate function written loop:

for( in 1:nrow( data ) ){     integrate( function(x)( data$intercept[i]+data$coeff1[i]*x+data$coeff2[i]*i(x^2) ), lower=60.1, upper=70.37 ) } 

as using sapply function have not been able either work. coding appreciated !!


Comments