Stats help - Linear Model fitting in R

In summary, the speaker is asking for help with a residual vs fitted values plot in R that should show a scatter of points with constant variance and mean 0. However, there is a diamond shape for the variance and the speaker has tried different transformations but none have worked. The speaker is looking for tips to improve the situation and asks about the number of explanatory variables and the intercept value. They also mention a clear linear trend in the residual plot and ask for the R code being used.
  • #1
aerot89
4
0
I have this residual vs fitted values plot in R, and it should show a scatter of points with constant variance and mean 0. The mean 0 part seems to hold, but there is quite a clear diamond shape for the variance...

I have tried raising the response variable to a power <1 and a log transformation, along with transforming all of the parameter types but all to no avail.

Any help would be greatly appreciated. Anyone have any tips as how to try and improve this...

Thanks

QpY3Z.png
 
Physics news on Phys.org
  • #2
How many explanatory variables do you have? What are you trying to model? Are you restricting your intercept to a value of zero? From the clear linear trend in your residual plot, a response transformation will not help your situation. What is the R code that you are using?
 

1. What is a linear model?

A linear model is a statistical method used to describe the relationship between two or more variables. It assumes that the relationship between the variables can be represented by a straight line. It is commonly used to predict the value of one variable based on the values of other variables.

2. How do I fit a linear model in R?

To fit a linear model in R, you can use the lm() function. This function takes in a formula as its first argument, where you specify the dependent variable and the independent variables. For example, lm(y ~ x1 + x2) would fit a linear model with y as the dependent variable and x1 and x2 as the independent variables.

3. What is the purpose of fitting a linear model?

The purpose of fitting a linear model is to understand the relationship between variables and to make predictions based on that relationship. It can help identify which variables are the most influential in predicting the outcome and can be used for data analysis and making informed decisions.

4. How do I interpret the results of a linear model in R?

The results of a linear model in R can be interpreted by looking at the coefficients for each variable in the model. These coefficients represent the slope of the line and indicate the direction and strength of the relationship between the variables. The p-value for each coefficient can also be used to determine the significance of the relationship.

5. Can a linear model be used for non-linear relationships?

No, a linear model assumes a linear relationship between variables and is not appropriate for non-linear relationships. In cases where the relationship is not linear, other types of models such as polynomial models or non-linear regression can be used.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
22
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
981
  • Set Theory, Logic, Probability, Statistics
Replies
23
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
17
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
830
  • Set Theory, Logic, Probability, Statistics
Replies
12
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
896
  • Set Theory, Logic, Probability, Statistics
Replies
26
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
7K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
948
Back
Top