0todd0000 / spm1d

One-Dimensional Statistical Parametric Mapping in Python
GNU General Public License v3.0
61 stars 21 forks source link

multiple linear regression #109

Closed limbicode214 closed 4 years ago

limbicode214 commented 4 years ago

Hi there

We are performing a SPM1D analysis (38 subjects) with lumbar curvature angle during a lifting maneveur as the dependent variable and questionnaire scores as independent. Because age, gender, size etc. might influence the outcome we would like to integrate these as nuisance variables in a multiple regression model. I've adapted the model from an example:

X = np.zeros((38,8)) #empty design matrix X[:,0] = regressor.iloc[:,0] #regressor of interest X[:,1] = 1 #intercept X[:,2] = nuisance.iloc[:,0] #age X[:,3] = nuisance.iloc[:,1] #male X[:,4] = nuisance.iloc[:,2] #female X[:,5] = nuisance.iloc[:,3] #weight X[:,6] = nuisance.iloc[:,4] #bendROM X[:,7] = nuisance.iloc[:,5] #ratio leg/size

c = np.array( [1,0,0,0,0,0,0,0] ) #contrast vector (for score of interest)

t = spm1d.stats.glm(Y, X, c) ti = t.inference(0.05)

I was wondering about the type of inclusion of the independent variables in the model as I did not find any info about it. Is it using the "ENTER" method or does the order of the independent variables have any influence (e.g. stepwise) ?

Thanks for your help, michael

0todd0000 commented 4 years ago

Hi Michael,

The procedure uses simple pseudo-inversion of the design matrix, not step-wise regression, so the order of variables shouldn't matter. Step-wise regression is not currently supported in spm1d.

Todd