GLM function selection method
I am using the General Linear Model (GLM) to extract features and get a beta matrix. I also got a matrix of class labels. This is a multi-class problem.
Now I want to use a t-test to select objects based on retrieving GLM objects. Can someone tell me how to write a t-test to make this feature selection? Thank you very much!
source to share
Have you tried using the function fitglm
? It can fit common linear models and will automatically return the p and t values ββfor all of your regressors:
mdl = fitglm(X,y,'linear','Distribution','normal')
If you prefer to compute t-tests yourself, you can run a t-test to check if your weights differ from 0 by calculating the t-statistic: beta/SE(beta)
for each of your weights beta
, where SE(beta)
is the standard error of your beta (or the square root of the diagonal of the variance matrix- covariance). You can read more about t-test for regressors here .
source to share