# Linear regression model in R

I have a dependent variable, Y, and an independent variable, X. For each value of the independent variable (there are four values for the independent variable "X"), I have a cluster of data points of dependent variable "Y". I want to build a linear model with logarithmic scales (so basically modelling a power law).

Do I have to take the mean of the cluster of data points for each independent variable value, or should I build the linear model with the cluster of points themselves?

What is the right approach in this case?

Thank you

• meta.stackexchange.com/questions/66377/what-is-the-xy-problem Nov 25, 2022 at 12:13
• What is the underlaying problem you are trying to solve? Could you describe actual data that you have (not "X" or "y")?
– Tim
Nov 25, 2022 at 12:22
• X (independent variable) is velocity. There are 4 values 0.4, 0.45, 0.5, 0.55 m/s. Whereas Y (dependent variable) is time. There are between 35-40 time values for each velocity value. So the question is should I take the average of the time values for each velocity value and then run linear regression (using log-transformed x and y values), or should I use the data as it is? Nov 25, 2022 at 12:30
• The answer depends on the statistical assumptions you make about the distribution of the response variables. Why do they vary and what distribution do you suppose would be a meaningful description of that variation?
– whuber
Nov 25, 2022 at 16:00