Search results

  1. S

    error term in linear regression

    Let's say I have a simple model like this: yi ~ beta1*xi + errori > dat <- data.frame(y=c(10,20,30,40),x=c(1,2,5,8)) > m <- lm(y~x,data=dat) summary(m) gives me this information Residuals: 1 2 3 4 -3 3 1 -1 Coefficients: Estimate Std. Error t value Pr(>|t|)...
  2. S

    orthogonalization question

    Thanks @noetsi, that makes sense. However, now that I think about it a bit more, when we include predictors in the model, say IV1 and IV2, isn't, for example, IV2 partialled out in relation to IV1, such that IV1 reflects unique contribution? How is it possible that variables that are included in...
  3. S

    help in setting up model with confounding variables

    @hlsmith, sorry that was supposed to be R-like syntax. DV is dependent variable, IV independent variable and COV the confounding variable. say my data frame (df) looks like: DV IV1 IV2 COV 43 x a 21 11 x b 32 53 y a 32 44 y b 12...
  4. S

    help in setting up model with confounding variables

    Hi! if I have a multiple regression model with two IVs such as DV ~ IV1 + IV2 + IV1:IV2, what is the appropriate way to include a confounding variables (COV) in the model? DV ~ IV1 + IV2 + IV1:IV2 + COV or do I need to specify all interactions with the COV as well? DV ~ IV1 + IV2 + COV +...
  5. S

    orthogonalization question

    Hi, is it a good idea to orthogonalize regressors in a regression model if they happen to be correlated? What are the cons and pros of orthogonalization? Thanks!
  6. S

    best fitting lines in PCA

    Hi, I'm learning about PCA and I don't get the point that PC2 is the next best fitting line after PC1. Wouldn't the second best fitting line be a line which is close to PC1? This second line will not be orthogonal to PC1 (which I'm aware is required) but it's likely to have a sum of squares of...
  7. S

    orthogonal lines

    Hi! I'm trying to learn PCA and am struggling with the concept of orthogonal lines, and why they need to be orthogonal. Is it correct to say that if two lines are orthogonal to each other then they are uncorrelated, independent or both? Thanks!
  8. S

    question regarding grouping several variables

    Thanks obh, that was very helpul. Do you mind if I ask you another question? If I go with Y=a0+a1X1 Y=a0+a1X2 do I need to correct for multiple testing? Oh I see. I thought repeated measures meant that I have more than two IVs per individual. In my case each individual is measured on two...
  9. S

    question regarding grouping several variables

    Thank you obh for your answer. I do not expect the models to give the same answer, I was just wondering if the second model is valid. Why am I not allowed to have this structure?: X1 X2 X1X2 Y 4 0 0 40 0 6 0 40 If y represents performance on math test and day1 and day2 are hours...
  10. S

    question regarding grouping several variables

    @obh I have updated my question with a runnable code.
  11. S

    question regarding grouping several variables

    Hello! In the context of regression, in what situations am I allowed to group separate variables into a single categorical predictor? I'll use R code as an example since it's what I'm most familiar with. For example I could run a model like this: dat <- data.frame(ind=c(1,2,3,4,5,6)...