People like you make the world a better place! Thank you so much for this video. I've been struggling with a solution and your levelsof explanation was just what I needed to solve the problem. 😊
Hi, I am facing troubles with the tab type command. STATA is showing "variable type not found" (r111). I think it'll work if you let us know the variables in your updated file. Maybe, my auto2_updated file does not consist of all the variables that you have in your dta. Thanks in advance.
Thank you for the video. I am trying to run cross validation with kfold. However, I want to use the first 13 observations to train the poisson model and then validate it with the last 5 observations. and then make the predictions. However my do file is giving me errors. This is my dofile: local num_folds = 3 forval fold = 1/'num_folds' { if `fold' 1 qui keep in 1/13 else if `fold' 2 qui keep in 1/13 else if `fold' 3 qui keep in 14/18 poisson NumberofAccidents Entrywidthe Entryangle Exitwidthex ExitRadius Cyclelanewidth InscribedDiameterD InAADTMajV lnAADTMajP lnAADTMinV lnAADTMinP, exposure(exposure) predict estimatedaccidents if `fold' 3 list estimatedaccidents if e(sample), noobs}
As I don't have the data so I can't test your do file. However, the thing that can be a possible cause of error is that you are trying to run mode on very few observations.
could you explain a little bit on global macros in stata? how to write data path using global and to include global path while writing the path of dictionary file in stata?
Thanks Shilpa for your reply. The given below code is a good example of how file paths can be used through globals. // setting up globals global projdir "C:/Users/amolr/Desktop/session_2" global raw_data "${projdir}/01_data/01_raw_data" global final_data "${projdir}/01_data/03_final_data" // importing the vaccination dataset as of 2021.04.18 use "${raw_data}/covid_vaccination_2021_04_18.dta", clear
@@learndataanalyticswithus5437 I think I need to use a nested loop. IDK how. The code without loop may look like this. How can I write a loop for this? Var_y is defined for Var_x>=5. gen var_z =. replace var_z=1 if Var_x ==1 replace var_z=1 if Var_x ==2 replace var_z=2 if Var_x ==3 replace var_z=3 if Var_x ==4 replace var_z=4 if Var_x == 5 & Var_y ==1 replace var_z=4 if Var_x == 5 & Var_y ==2 replace var_z=5 if Var_x == 6 & Var_y ==1 replace var_z=5 if Var_x == 6 & Var_y ==2
People like you make the world a better place! Thank you so much for this video. I've been struggling with a solution and your levelsof explanation was just what I needed to solve the problem. 😊
Thanks for your appreciation!! :)
Hi, I am facing troubles with the tab type command. STATA is showing "variable type not found" (r111). I think it'll work if you let us know the variables in your updated file. Maybe, my auto2_updated file does not consist of all the variables that you have in your dta. Thanks in advance.
Thank you for the video. I am trying to run cross validation with kfold. However, I want to use the first 13 observations to train the poisson model and then validate it with the last 5 observations. and then make the predictions. However my do file is giving me errors. This is my dofile: local num_folds = 3
forval fold = 1/'num_folds' {
if `fold' 1 qui keep in 1/13
else if `fold' 2 qui keep in 1/13
else if `fold' 3 qui keep in 14/18
poisson NumberofAccidents Entrywidthe Entryangle Exitwidthex ExitRadius Cyclelanewidth InscribedDiameterD InAADTMajV lnAADTMajP lnAADTMinV lnAADTMinP, exposure(exposure)
predict estimatedaccidents if `fold' 3
list estimatedaccidents if e(sample), noobs}
As I don't have the data so I can't test your do file. However, the thing that can be a possible cause of error is that you are trying to run mode on very few observations.
could you explain a little bit on global macros in stata? how to write data path using global and to include global path while writing the path of dictionary file in stata?
Thanks Shilpa for your reply.
The given below code is a good example of how file paths can be used through globals.
// setting up globals
global projdir "C:/Users/amolr/Desktop/session_2"
global raw_data "${projdir}/01_data/01_raw_data"
global final_data "${projdir}/01_data/03_final_data"
// importing the vaccination dataset as of 2021.04.18
use "${raw_data}/covid_vaccination_2021_04_18.dta", clear
THANK YOU
You are welcome!
how to add the command replace variable x if y== some value within a loop? so that both x and y gets added by 1 in each iteration?
Can you explain your question with a numeric example? Sorry I am a bit unclear about your question. Thanks
@@learndataanalyticswithus5437 I think I need to use a nested loop. IDK how. The code without loop may look like this. How can I write a loop for this? Var_y is defined for Var_x>=5.
gen var_z =.
replace var_z=1 if Var_x ==1
replace var_z=1 if Var_x ==2
replace var_z=2 if Var_x ==3
replace var_z=3 if Var_x ==4
replace var_z=4 if Var_x == 5 & Var_y ==1
replace var_z=4 if Var_x == 5 & Var_y ==2
replace var_z=5 if Var_x == 6 & Var_y ==1
replace var_z=5 if Var_x == 6 & Var_y ==2
Maybe
replace 'i' if var_x>=5
In above eq i will be contacting variable y
i want to get mean of two variable i run following command and i get error invalid syntax r(198);
foreach c inagcro ainc v_dairyinc {
tabstat `c'
}
What's the command you are running?
can anyone help what error am i making
foreach c inagcro ainc v_dairyinc {
tabstat `c'
}
Try foreach c of ...
Or try
foreach c in ....
foreach c in .... worked