Hello, Statalist!
I am attempting to perform a cross-validation (CV) exercise using the SSC package crossvalidate2, command xv, using Stata 15 on Windows 11.
I am trying to generate the CV with:
Despite omitting factor-variable and time-series operators in my code, I am getting this error:
I have tried running the CV using Stata 19 through a virtual desktop and received the same error, so I suspect this issue isn't explained by Stata version.
I have also tried running the xv command with other dependent and independent variables, and still get the same error, so I don't think the variables themselves explain the problem either.
I have considered using the H2O CV tools, but it seems they only work with gradient boosting machine (GBM) or random forest (RF) regression. I would like my CV to hew as closely as possible to my main set of analyses, which use Stata's regress and logistic commands. It isn't clear to me whether GBM or RF cross-validation results would be comparable to my primary analyses. And, H2O requires Stata 19; I can access Stata 19 through a virtual desktop, but it is slow, so I am crossing my fingers that I can find a way to get xv to work on my machine.
Any help in figuring out why this error persists would be much appreciated!
Here is example data and the commands I am running:
I am attempting to perform a cross-validation (CV) exercise using the SSC package crossvalidate2, command xv, using Stata 15 on Windows 11.
I am trying to generate the CV with:
Code:
ssc install crossvalidate2 xv 0.8, metric(mse): reg log_wages screener_hispanic
Code:
factor-variable and time-series operators not allowed r(101);
I have also tried running the xv command with other dependent and independent variables, and still get the same error, so I don't think the variables themselves explain the problem either.
I have considered using the H2O CV tools, but it seems they only work with gradient boosting machine (GBM) or random forest (RF) regression. I would like my CV to hew as closely as possible to my main set of analyses, which use Stata's regress and logistic commands. It isn't clear to me whether GBM or RF cross-validation results would be comparable to my primary analyses. And, H2O requires Stata 19; I can access Stata 19 through a virtual desktop, but it is slow, so I am crossing my fingers that I can find a way to get xv to work on my machine.
Any help in figuring out why this error persists would be much appreciated!
Here is example data and the commands I am running:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(log_wages screener_hispanic)
. 0
2.2055233 0
. 0
. 0
. 0
3.445108 0
2.626117 0
2.795043 0
3.054473 0
. 0
3.0041964 0
. 0
2.977738 0
3.630897 0
. 0
3.379974 0
3.30707 0
4.005422 0
. 0
3.63275 0
3.715521 0
2.9493394 0
. 0
. 0
2.995566 0
. 0
. 0
. 0
3.4324806 0
. 0
2.902703 1
3.583102 1
2.3025851 1
2.0869136 0
. 0
3.259634 0
2.92352 0
3.4062955 0
3.130846 0
3.304442 0
3.57169 0
2.994064 0
1.8718022 0
2.3025851 0
. 0
3.264486 0
3.264486 0
. 0
3.1535904 0
2.90526 0
. 0
. 0
1.6389967 1
2.890372 0
. 0
. 0
2.650892 0
3.280911 0
3.0445225 0
. 0
3.243373 0
2.924057 0
3.678913 0
. 0
. 0
2.833213 0
. 0
. 0
3.6156814 0
3.141995 0
. 0
2.890372 0
4.0715876 0
. 0
3.5695326 0
2.860294 0
3.438921 0
3.203762 0
4.047078 0
1.8771724 0
2.650421 0
. 0
. 0
2.014903 0
2.1690538 0
2.184177 0
2.3191144 0
2.486156 0
3.165897 0
3.928421 0
3.0170045 0
2.817004 0
3.371883 0
2.878449 0
2.6957526 0
3.0150445 0
3.111736 0
. 0
2.3639936 0
3.3943965 0
end
label values screener_hispanic screener_hispanic
label def screener_hispanic 0 "Non-Hispanic", modify
label def screener_hispanic 1 "Hispanic", modify
*** Attempt at cross-validation:
ssc install crossvalidate2
xv 0.8, metric(mse): reg log_wages screener_hispanic // error code r(101): factor-variable and time-series operators not allowed

Comment