Hi, I'm new to Matlab sorry if my question is silly. I have dataset consists of 100 rows and 10 column which are Age, Diastolic, Gender, Height, systolic, LastName, Weight, Smoker, Location, SelfAssessedHealthStatus. I need to create a linear regression to predict systolic based on Age, Gender, Height, Weight, Smoker, Location, SelfAssessedHealthStatus. the problem for me is I have 3 categorical variables I'm not sure about how to deal with them in right way. belew is my try. can you please suggest to me how to deal with them..
if true load ('patients');patients= table(Age, Gender, Height, Location, SelfAssessedHealthStatus, Smoker, Weight);patients.Gender = nominal(patients.Gender);dv = dummyvar(patients.Gender);patients.Location = nominal(patients.Location);dv1 = dummyvar(patients.Location);patients.SelfAssessedHealthStatus = nominal(patients.SelfAssessedHealthStatus);dv2= dummyvar(patients.Location);x=[Age dv Height Weight Smoker dv1 dv2];y= Systolic;ml=fitlm(x,y)end
Best Answer