using ANOVAN to analyse categorical data

Hello I have two climate data files, each of them is one column (temperature and moisture) and four plant types existence and absence results (0 for absence, 1 for existence), I made each variable in separate txt file in one column . I want to test the significance effect of the interaction of two predictors climate factors (temp and moisture) on the plan occurrence. for example: (temp*moisture)on plant1, and so on. I have used this code p=anovan (plant,{temp moisture}, 'model, 'interaction'); but it didn't work, I think the mistake is of my plants data which is zeros and ones. any suggestions plz. Regards

 채택된 답변

Tom Lane
Tom Lane 2012년 4월 12일

0 개 추천

You should be able to adapt this for your logistic model:
load hald
[b,dev,st] = glmfit(ingredients,heat);
dataset(b, st.se, st.t, st.p, 'varnames',{'coef' 'se' 't' 'p'})

추가 답변 (2개)

Tom Lane
Tom Lane 2012년 4월 7일

0 개 추천

You could use a logistic regression to predict the probability of "existence" using predictors temp, moisture, temp.*moisture. You can fit this regression using glmfit, or in the most recent release using GeneralizedLinearModel.fit. The latter might be the easier of the two because it has a number of built-in features for plotting, model building, and diagnostics.
Other choices for binary data include knn classification, classification trees, and discriminant analysis.
Now, this would be for a single binary response or dependent variable. If you have four of them, you could do it four times.

댓글 수: 2

Yasmine
Yasmine 2012년 4월 8일
hi Tom thank you so much
can you write me the code of using GeneralizedLinearMode in Matlab?
Daniel Shub
Daniel Shub 2012년 4월 9일
In general we do not write code for people, but help them along.

댓글을 달려면 로그인하십시오.

Tom Lane
Tom Lane 2012년 4월 9일

0 개 추천

I don't mind supplying code comparing glmfit and the new feature, but of course you will have to adapt it for your own use. Here's an example where I fit a single binary response using a model with interactions:
a = rand(100,1); b = rand(100,1); y = binornd(1,max(a,b));
glmfit([a b a.*b],y,'binomial')
GeneralizedLinearModel.fit([a b],y,'interactions','distribution','binomial')

댓글 수: 4

Yasmine
Yasmine 2012년 4월 10일
And you know what I've tried many other options for the
GeneralizedLinearModel.fit, but the program considers it as undefined variable.
Tom Lane
Tom Lane 2012년 4월 10일
You should use glmfit then. GeneralizedLinearModel.fit is new in the R2012a version of MATLAB.
Yasmine
Yasmine 2012년 4월 11일
Thanks Tom that is so helpful, BUT..I've got a coeffecients but not the P values, I need to test the significant of these veg distribution ..ANY SUGGESTIONS
Yasmine
Yasmine 2012년 4월 12일
YES YES tom I've done it, I just want to ensure that the (st)values are the significancy values, right?
Thanks so much Tom

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기

태그

질문:

2012년 4월 6일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by