These are my first two questions to ask on Stackoverflow - hopefully, I ask my questions the right way:
First Question: Standard Error
I am not entirely sure how the standard errors are specified using the "MSwM" package in R. As my data suffers from autocorrelation and heteroskedasticity, I am not sure how I can counteract these issues. I tried to do the following, but unfortunately, it did not work out the way I wanted (I want to use either Newey West standard errors or HAC standard errors):
fit1 <-lm(wage ~ educ + familystatus + region)
fit2 <- coeftest(fit1,vcov=NeweyWest(fit1,verbose=T))
mod.mswm = msmFit(fit2, k = 2, sw = rep(TRUE, 5), control=list(parallel=FALSE))
summary(mod.mswm)
Unfortunately, I receive the following error:
unable to find an inherited method for function ‘msmFit’ for signature
‘"coeftest", "numeric", "logical", "missing", "missing", "missing"’
Does anyone know how I could specify my desired standard errors using the "MSwM" package or is it not necessary at all?
Second Question: Latex Output
I do have multiple Markov Switching regressions in R (20 regressions in total). Thus, I am looking for a neat way to receive latex tables by using the "Stargazer" or "TexReg" package for example. I am afraid that this might not be possible since the "MSwM" package might not be available for "Stargazer" or "TexReg".
Here is some sample code I want to get Latex output from:
ms = msmFit(ols, k = 2, sw = rep(TRUE, 4))
summary(ms) # Obtaining the results for the first Markov-Regime Regression
The coefficients are reported as follows (using some example code):
Coefficients:
Regime 1
---------
Estimate Std. Error t value Pr(>|t|)
(Intercept)(S) 0.8417 0.3025 2.7825 0.005394 **
x(S) -0.0533 0.1340 -0.3978 0.690778
y_1(S) 0.9208 0.0306 30.0915 < 2.2e-16 ***
---
Signif. codes: 0 ´S***ˇS 0.001 ´S**ˇS 0.01 ´S*ˇS 0.05 ´S.ˇS 0.1 ´S ˇS 1
Residual standard error: 0.5034675
Multiple R-squared: 0.8375
Standardized Residuals:
Min Q1 Med Q3 Max
-1.5153666657 -0.0906543311 0.0001873641 0.1656717256 1.2020898986
Regime 2
---------
Estimate Std. Error t value Pr(>|t|)
(Intercept)(S) 8.6393 0.7244 11.9261 < 2.2e-16 ***
x(S) 1.8771 0.3107 6.0415 1.527e-09 ***
y_1(S) -0.0569 0.0797 -0.7139 0.4753
---
Signif. codes: 0 ´S***ˇS 0.001 ´S**ˇS 0.01 ´S*ˇS 0.05 ´S.ˇS 0.1 ´S ˇS 1
Residual standard error: 0.9339683
Multiple R-squared: 0.2408
Standardized Residuals:
Min Q1 Med Q3 Max
-2.31102193 -0.03317756 0.01034139 0.04509105 2.85245598
Transition probabilities:
Regime 1 Regime 2
Regime 1 0.98499728 0.02290884
Regime 2 0.01500272 0.97709116
Is there any way to get a Latex output using Stargazer or any other available packages? If so, how do I have to specify the parameters of the corresponding package?
Any help is highly appreciated. Thank you very much in advance.