2
$\begingroup$

Possible Duplicate:
How to test the statistical significance for categorical variable in linear regression?

As we know we can use linear models for numeric dataset(independent variables are numerical only), but what type model is applicable here when I have numeric + categorical dataset(independent variables are combination of numeric and categorical).

for example I have two datasets

1.numeric dataset 2.numeric dataset + categorical dataset

1.numeric dataset (Prediction of price of home)

Independent variables
x1 =  numbers of bedrooms
x2 =  size of home in sq. feet

dependent variable
x3 =  price of home

here
dependent variable is numerical
independent variable is with numerical values


2.numeric dataset + categorical dataset(prediction of web visits)

Independent variables
x1 =  search time
x2 =  search query
x3 =  browser
x4 = country

dependent variable
x3 =  visits

here 
dependent variable is numerical
independent variable is with combination of numerical and categorical values

I assume here that for dataset 1 linear model with lm() is applicable, but its not possible for second dataset. can any one suggest best technique for dataset 2 to be implemented with model for prediction.

$\endgroup$
0

1 Answer 1

3
$\begingroup$

There is nothing wrong with using categorical independent variables, but they are typically broken into indicator or "dummy" variables, one for each level that the categorical variable can take on. But one category's dummy variable needs to be left out of the model due to the "dummy variable trap" identification problem. For more information, see this question, for example.

$\endgroup$
1
  • 1
    $\begingroup$ linear models with mixture of categorical and continuous variables can be referred to as regression models but the method of solving via OLS is usual referred to as the analysis of covariance. $\endgroup$ Commented Sep 15, 2012 at 1:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.