search for: danielobo9976

Displaying 2 results from an estimated 2 matches for "danielobo9976".

2024 Sep 04
2
Calculation of VCV matrix of estimated coefficient
Hi, I am trying to replicate the R's result for VCV matrix of estimated coefficients from linear model as below data(mtcars) model <- lm(mpg~disp+hp, data=mtcars) model_summ <-summary(model) MSE = mean(model_summ$residuals^2) vcov(model) Now I want to calculate the same thing manually, library(dplyr) X = as.matrix(mtcars[, c('disp', 'hp')] %>% mutate(Intercept =
2024 Sep 05
1
Calculation of VCV matrix of estimated coefficient
sigma(model)^2 will give the correct MSE. Also note that your model matrix has intercept at the end whereas vcov will have it at the beginning so you will need to permute the rows and columns to get them to be the same/ On Wed, Sep 4, 2024 at 3:34?PM Daniel Lobo <danielobo9976 at gmail.com> wrote: > > Hi, > > I am trying to replicate the R's result for VCV matrix of estimated > coefficients from linear model as below > > data(mtcars) > model <- lm(mpg~disp+hp, data=mtcars) > model_summ <-summary(model) > MSE = mean(model_summ$re...