# Methods of doing hypothesis testing on two continuous variables from same sample

If given a sample from a population how should we test the significance of a continuous random variable on another continuous random variable in the same sample?

For example - given a sample of population of automobiles with variables including make, price, height, etc. We want to determine what influences price the most.

I know I should probably use the student-t test but it seems strange since the student test from what I've read seems to be done using the same variable on different populations. Comparing, say, height and price with that test on items in the same sample seems to not be correct.

Can someone clarify this for me?

Thanks!

• your question is poorly designed ? please rewrite it after a few readings. – Subhash C. Davar Jul 14 '18 at 18:07
• i'm sorry i'm not sure what is confusing to you? i have 2+ continuously distributed random variables that i want to compare to another continuously distributed random variable to find which has the highest influence on it – Ben Nelson Jul 16 '18 at 2:00
• Your first paragraph raises a question about significance testing . The second para insists what influences price most ? does not propose whether you want modelling the price with Anova or regression model or any comparison method. Third para is suggestive of different preliminary techniques that focus on categorical variables. I can not make out whether your interest can be served with particular inferential statistics and or you are keenly searching for a descriptive model that can help you explain the price or else ? Comment is intended to enable structure the question. – Subhash C. Davar Jul 16 '18 at 5:55
• Yes I don't suggest a modeling type to solve the problem. That is the point of the question. I don't know which approaches are valid for the comparisons of the different variables of a particular type to determine which influences more. – Ben Nelson Jul 16 '18 at 15:43
• This expression does not make sense "the significance of a continuous random variable". – Sextus Empiricus Jul 16 '18 at 15:48

Why not trying a regression model? For instance, with linear regression of price on your other variables, you can use a t-test to assess the significance of each coefficient (thus giving the significance of the influence of the corresponding variable on the price).

• That sounds intriguing! I'm just doing a beginning section right now on hypothesis testing and haven't really gotten to regression yet - can you clarify a bit on what I would do in this instance? How would I use the t-test on a regression coefficient? – Ben Nelson Jul 13 '18 at 18:46
• Ah... If you're attending a course which asks you this question, maybe there's a simpler idea to search for. Anyway, if you really want to know more about my answer, see reliawiki.org/index.php/… – paf Jul 13 '18 at 19:04
• In response to your comment (apples and oranges elsewhere I want to tell you that firstly values of variables need to be transformed into Z scores and then proceded with further analysis – Subhash C. Davar Jul 17 '18 at 12:37
• There is no point in transforming variables into Z scores before further analysis. Why would you even consider that for this particular problem? – Björn Jul 20 '18 at 10:55
• @Björn A re-thinking tells me that your assertions are correct. – Subhash C. Davar Jul 20 '18 at 15:55

If I understand your question correctly, you are interested in modelling the effect of one or more continuous variables on a single continuous response variable. You give the example of modelling automobiles using a number of predictor variables affecting the price. This problem falls within the scope of regression analysis, which looks at cases where you have a set of predictors and you want to model the conditional distribution of a response variable given values for those predictors.

Regression analysis is a broad field and there are many different models. When you have one or more continuous predictors and a continuous response variable, you will need to posit some kind of functional form linking these variables. The particular functional form will lead you to a particular model, and you can then fit the model and see if it looks okay. You can usually get a good idea of the kind of functional form you should use by first plotting your data in a scatter-plot.

(Incidentally, it is worth noting that the two-sample T-test assuming equal variances is a special case of regression analysis, where you have a single binary predictor and a continuous response. In that case a simple linear regression model degenerates down to the T-test. In your case you would not use this because your predictor is continuous, not a binary variable.)

If you are able to post a plot of your data (or just the raw data) we can have a look at this for you and recommend an appropriate starting point for the kind of model that might fit this data. It is worth noting that regression analysis usually involves positing an initial model, fitting the model, and then looking at diagnostic plots and tests to see if the assumed model form is reasonable. This means that we generally posit an initial model without being certain it will be appropriate for the data, and through an iterative process of model improvement we try to get to something that is a reasonable form based on the observed data.

Example (simple linear regression): A simple linear regression model in this case would be:

$$\text{Price }_i = \beta_0 + \beta_1 \cdot \text{Height }_i + \varepsilon_i \quad \quad \quad \varepsilon_i \sim \text{IID N}(0,\sigma^2).$$

This model uses an assumed linear relationship between price and height. It would be suitable if your data shows that there is a rough "straight-line" relationship between price and height.

Example (log-linear regression): A log-linear regression model in this case would be:

$$\log \text{Price }_i = \beta_0 + \beta_1 \cdot \log \text{Height }_i + \varepsilon_i \quad \quad \quad \varepsilon_i \sim \text{IID N}(0,\sigma^2).$$

This model uses an assumed linear relationship between the logarithms of price and height. It would be suitable if the percentage changes in both quantities stand in a linear relationship. This kind of model sometimes fits data where the values are strictly positive and related in a multiplicative way.

• how should we test significance?
• how to determine what influences price the most?

The first question is ansewered in @paf's answer: multiple linear regression is an obvius choice. This would produce p-value (from t-test) for each of your prodictors.

Although, this have a drawback mentioned in @Ben's answer: linear regression can catch only linear relatioship, so you may consider transforming your data (log-transforming for example).

For the second question: You can still use linear regression to pick a variable that influences price the most. All you have to do is to compute so called standardized coefficients of regression. How to do that? Simply standardize all your variables before running regression.

To standardize a single variable you subtract it's mean from it and then divide it by it's standard deviation:

$$x_{standardized} = \frac{x-mean(x)}{sd(x)}$$

This makes all the variables work on the same scale and thus makes coefficients of regression comparable.

Yet, still it can suffer from nonlinearity of relationship between your variables.

Another option, that overcomes this, is calculating Spearman's rank correlation coefficients. They can handle nonlinear relationship quite well and come with significance test. Obvoiusly, there is a catch: this is univariate technique, so it does not take into account possibly confounding effects of other variables. Regression (multivariate) does so.

All in all, there's no golden mean...