1
$\begingroup$

I have fitted a censored regression model in R which whose outputs look like this

library(carx)
SAmodel <- carx(y=SAdata$CC, x=SAdata[,c("CPI","LI","FDI","FPI", "OI")], lcl=1.996866, p=2, CI.compute = FALSE, CI.level = 0.95)

summary(SAmodel)
Call:
carx.default(y = SAdata$CC, x = SAdata[, c("CPI", "LI", "FDI", "FPI", 
"OI")], lcl = 1.996866, p = 2, CI.compute = FALSE, CI.level = 0.95)


Coefficients Estimate
CPI     0.0804
LI     -0.0088
FDI    -0.0395
FPI    -0.0166
OI      0.0488
AR1     1.6324
AR2    -0.7097
sigma   0.4286

AIC:
[1] -72.92045

The outputs come with no standard errors and no confidence intervals, those can be obtained by bootstrapping which could take tremendous time, probably more than a day, so I decided to manually calculate the standard errors. I know how standard errors are calculated for the coefficients in multiple regression and based on that I did the following calculations

#Calculating the residuals of the fitted model
SAres = residuals(SAmodel,type="raw")
# Find the sum of the squared residuals
rss <- sum(SAres^2)
# find the estimate of sigma^2, commonly called S
S <- sqrt(rss / (length(SAres) - length(SAmodel$coefficients)))
# Make the X matrix; a column of 1s for the intercept and one for each variable
X <- cbind(rep( nrow(SAdata)), SAdata$CPI, SAdata$LI,SAdata$FDI, SAdata$FPI, SAdata$OI)
# Multiply matrices using %*%, transpose them with t(),
# and invert them with solve(); and directly apply the formula above with:
std.errors <- S * sqrt(diag(solve(t(X) %*% X)))

std.errors
[1] 0.001232184 0.037669933 0.010483153 0.068843648 0.040779940 0.063888636

But I don't know how to apply this to a model where there are additional parameters such as sigma and autoregressive terms. What is the formula to calculate the standard errors for these terms?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.