using ANOVAN to analyse categorical data
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Akzeptierte Antwort
Tom Lane
am 12 Apr. 2012
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'})
0 Kommentare
Weitere Antworten (2)
Tom Lane
am 7 Apr. 2012
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 Kommentare
Tom Lane
am 9 Apr. 2012
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 Kommentare
Siehe auch
Kategorien
Mehr zu Descriptive Statistics and Visualization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!