Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GLM feature selection method

I use General Linear Model (GLM) to do feature extraction and to get a beta-matrix. I also got a class-label-matrix. It is a multiple class problem.

Now I want to use t-test to do feature selection based on GLM feature extraction. Can anyone tell me how to write t-test to do this feature selection? Thank you so much!

like image 978
Angelababy Avatar asked Jun 18 '26 09:06

Angelababy


1 Answers

Have you tried using the function fitglm? It can fit general linear models and returns p-values and t statistics for all your regressors automatically:

mdl = fitglm(X,y,'linear','Distribution','normal')

If you'd prefer calculating the t-tests yourself, you can run a t-test for testing whether your weights are significantly different than 0 by calculating the t-statistic: beta/SE(beta) for each of your weights beta, where SE(beta) is the standard error of your betas (or, the square root of the diagonal of the variance-covariance matrix). You can read more about the t-test for regressors here.

like image 101
mobeets Avatar answered Jun 20 '26 09:06

mobeets



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!