Convert a categorical variable to a numerical variable prior to regression I am doing a project to estimate students' final graduation GPAs based on several variables. I have students' first year GPAs, high school GPAs, their race, where they come from, and their ACT score, and so on. 
I have two questions:


*

*How to convert race into numbers, I know I can just assign white to be 1, Black to be 2, Asian to be 3, but it may cause some problem that make my result not significant, so how do I convert the race into numbers to make my model more accurate?

*How do I find which factor make the most contribution to estimate students final GPA, so I can put more weight on it?
 A: 1) Why do you want to convert race into numbers?  I'm assuming you want to do something like a regression model, is that correct?  I'm going to assume you're asking how to handle "categorical data" (categories like different races) in regression.
So, you want numerical variables, and you could just assign a number to each race.  But, if you choose White=1, Black=2, Asian=3 then does it really make sense that the distance between White's and Black's is exactly half the distance between White's and Asian's?  And, is that ordering even correct?  Probably not.
Instead, what you do is create dummy variables.  Let's say you have just those three races.  Then, you create two dummy variables: White, Black.  You could also use White, Asian or Black, Asian; the key is that you always create one fewer dummy variables then categories.  Now, the White variable is 1 if the individual is white and is 0 otherwise, and the Black variable is 1 if the individual is black and is 0 otherwise.  If you now fit a regression model, the coefficient for White tells you the average difference between asians and whites (note that the Asian dummy variable was not used, so asians become the baseline we compare to).  The coefficient for Black tells you the average difference between asians and blacks.
Note: If you're using software to fit your regression model, you probably don't have to worry about all this.  You just tell your software that the variable is categorical, and it handles all these details.
2)  You don't need to worry about this, at least if you're doing a regression.  Running the regression model will tell you coefficients for each variable as well as their standard errors, and that information tells you which variables are most important.  If you want help interpreting those coefficients, that's a whole new topic.
A: Answer for your questions:
1) how do I convert the race into numbers to make my model more accurate?
-> I think answer lies in which tool you are using for analysis. Most of the tool have facility to convert attributes/factor in appropriate inputs. To explain your first question you can refer following link:
You can find your answer precisely here: http://www.ats.ucla.edu/stat/r/dae/logit.htm
It's self-explanatory article on admission based on GPA and ranks.
I am just recreating example from there. Tool used in this blog is R, freeware statistical analysis tool.
Data would look like this:
##   admit gre  gpa rank
## 1     0 380 3.61    3
## 2     1 660 3.67    3
## 3     1 800 4.00    1
## 4     1 640 3.19    4
## 5     0 520 2.93    4
## 6     1 760 3.00    2

Admit is output, 1 means student got admission. Now lets make rank as category:
mydata$rank <- factor(mydata$rank)

You can use other input into factor/category using above method. Now we will prepare a regression model for above table.
mylogit <- glm(admit ~ gre + gpa + rank, data = mydata, family = "binomial")

Above function will prepare a logistic regression model where we are checking whether admission depends on GRE,GPA or rank. Using summary function you get see the results.
summary(mylogit)


2) How do I find which factor make the most contribution to estimate students final GPA, so I can put more weight on it?
-> You don't have to give weight before hand, regression table will give you weight (co-efficient) for each input along with its statistical significance. 
I hope I have cleared your answer.
