Calculate R^2 of two graphs
    17 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Oliver Makan
 el 12 de Nov. de 2021
  
    
    
    
    
    Comentada: Star Strider
      
      
 el 18 de Nov. de 2021
            Hi guys,
I wanted to know if it is possible to calculate the goodness of fit or R^2 to evaluate the performance of the fit.
I have two separate graphs which are separately calculated: the probability plot (brown) and the dataset (blue cross).
I know that it is able to fit a predefined graph ( e.g. quadratic, polynomial etc.) to a dataset with the toolbox but is it possible to fit my calculated graph to the dataset ?
Thank you


0 comentarios
Respuesta aceptada
  Star Strider
      
      
 el 12 de Nov. de 2021
        One approach — 
x = linspace(0.1, 85, 50);                                              % Create Data
y = atanh((x-mean(x))/max(x)*2)/4+0.5 + randn(size(x))*0.01;            % Create Data
X = [x(:).^3 x(:).^2 x(:) ones(size(x(:)))];                            % Design Matrix
[B,Bint,R,Rint,Stats] = regress(y(:), X);
ParameterStats = table(Bint(:,1), B, Bint(:,2), 'VariableNames',{'Lower 95% CI','Parameter Value','Upper 95% CI'}, 'RowNames',{'x^3','x^2','x','Const'})
Rsq = Stats(1)
F_p = [Stats(2:3)]
ErrorVar_Est = Stats(4)
figure
plot(x, y, '+b')
hold on
plot(x, X*B, '-r')
hold off
grid
Experiment with the actual data.  
.
3 comentarios
Más respuestas (1)
Ver también
Categorías
				Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




