www.vorhilfe.de
- Förderverein -
Der Förderverein.

Gemeinnütziger Verein zur Finanzierung des Projekts Vorhilfe.de.
Hallo Gast!einloggen | registrieren ]
Startseite · Mitglieder · Impressum
Forenbaum
^ Forenbaum
Status VH e.V.
  Status Vereinsforum

Gezeigt werden alle Foren bis zur Tiefe 2

Navigation
 Startseite...
 Suchen
 Impressum
Das Projekt
Server und Internetanbindung werden durch Spenden finanziert.
Organisiert wird das Projekt von unserem Koordinatorenteam.
Hunderte Mitglieder helfen ehrenamtlich in unseren moderierten Foren.
Anbieter der Seite ist der gemeinnützige Verein "Vorhilfe.de e.V.".
Partnerseiten
Weitere Fächer:

Open Source FunktionenplotterFunkyPlot: Kostenloser und quelloffener Funktionenplotter für Linux und andere Betriebssysteme
Forum "Matlab" - Anova1
Anova1 < Matlab < Mathe-Software < Mathe < Vorhilfe
Ansicht: [ geschachtelt ] | ^ Forum "Matlab"  | ^^ Alle Foren  | ^ Forenbaum  | Materialien

Anova1: Frage (beantwortet)
Status: (Frage) beantwortet Status 
Datum: 08:48 Sa 16.06.2007
Autor: makabeli

Hallo,

ich soll ne Varianzanalyse mit Matlab machen, aber in den Daten die ich bekommen habe sind NaN drin, wie geh ich denn damit um?

        
Bezug
Anova1: Antwort
Status: (Antwort) fertig Status 
Datum: 18:09 Sa 16.06.2007
Autor: BKM

Hallo.

Ich könnte mir vorstellen, dass dieses Programm bei den fehlenden Daten helfen kann. Ansonsten einfach an die Gegebenheiten  anpassen.

Beste Grüße.

% Program to compute a covariance matrix ignoring NaNs
% Usage: C = nancov(A,B)
% NANCOV calculates the matrix product A*B ignoring NaNs by replacing them
% with zeros, and then normalizing each element C(i,j) by the number of
% non-NaN values in the vector product A(i,:)*B(:,j).
%
% A - left hand matrix to be multiplied
% B - right hand matrix to be multiplied
% C - resultant covariance matrix
% Example: A = [1 NaN 1] , B = [1
%                               1
%                               1]
% then nancov(A,B) is 2/2 = 1

function [C]=nancov(A,B);

NmatA=~isnan(A); % Counter matrix
NmatB=~isnan(B);

A(isnan(A))=0; % Replace NaNs in A,B, and counter matrices
B(isnan(B))=0; % with zeros

Npts=NmatA*NmatB;
C=(A*B)./Npts;

% NANEOF.M
% Function to compute EOFs from demeaned data with NaNs:
% function [B,vars,amps]=naneof(anom);
% Computes EOFs of ROW DIMENSION in anom matrix

function [B,vars,amps]=naneof(anom);

%-----------------------------------------------------------------------
% Compute covariance of matrix with NaNs
Cov=nancov(anom,anom');

%-----------------------------------------------------------------------
% Compute eigenvectors (EOFs), eigenvalues (variances of amplitudes) of
% data covariance matrix

[B,D]=eig(Cov);       % B = EOFs, diag(D) = eigenvalues
vars=flipud(diag(D)); % eigenvalues = variances of each amplitude

% EIG outputs from low to high, so flip column
% to order from high to low
B=fliplr(B);          % Flip columns left/right to correspond
                      % to adjusted ordering of amplitudes

%-----------------------------------------------------------------------
% Put 0's in for NaNs in ANOM matrix to be able to compute amplitudes

anom(isnan(anom))=0;
amps=B'*anom;          % amplitudes

%-----------------------------------------------------------------------


Bezug
Ansicht: [ geschachtelt ] | ^ Forum "Matlab"  | ^^ Alle Foren  | ^ Forenbaum  | Materialien


^ Seitenanfang ^
ev.vorhilfe.de
[ Startseite | Mitglieder | Impressum ]