Dear Statalist,
I am trying to combine qualifiers in a regression, however, I receive error messages and would be very thankful if anyone could help improve my model.
Unfortunately, I cannot share the data I am working on but I have created something similar using the exemplary auto data file. I apologize if the logit regression here does not make sense, I am trying to understand the main method.
Using the auto datafile
In essence, I would only like to consider the cases where the make is AMC Pacer, only those i. foreign rows that have "Buick Regal" as their make, i.heavy if the make is Chev Monza, all rows of i.efficient and only those cases where the gear ratio is large.
When running said logit model, Stata returns an invalid 'i.foreign' error
Initially, I thought of creating new variables, such as exp & AMC Pacer etc., but that led to missing variables within that new variable, which I would like to avoid.
I am thankful for any advice on my model and how to proceed.
I am trying to combine qualifiers in a regression, however, I receive error messages and would be very thankful if anyone could help improve my model.
Unfortunately, I cannot share the data I am working on but I have created something similar using the exemplary auto data file. I apologize if the logit regression here does not make sense, I am trying to understand the main method.
Using the auto datafile
Code:
clear sysuse auto gen exp = 1 if price > 5000, before(mpg) replace exp = 0 if price < 5000 gen heavy = 1 if weight > 3000, before(length) replace heavy = 0 if weight < 3000 gen gear_ratio_large = 1 if gear_ratio > 3, before(foreign) replace gear_ratio_large = 0 if gear_ratio < 3 gen efficient = 1 if mpg <= 17, before(rep78) replace efficient = 0 if mpg > 17
Code:
logit exp if make == "AMC Pacer" i.foreign if make == "Buick Regal" i.heavy if make == "Chev. Monza" i.efficient i.gear_ratio_large if == 1
When running said logit model, Stata returns an invalid 'i.foreign' error
Initially, I thought of creating new variables, such as exp & AMC Pacer etc., but that led to missing variables within that new variable, which I would like to avoid.
I am thankful for any advice on my model and how to proceed.
Comment