Polynomial regression I: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
Through the points defining the dashed line the regression polynomial of degree 'degree' is computed and displayed.
The points can be scaled by adjusting the slider 'scale'. The degree of the regression polynomial can be changed
by using the slider 'degree'.
<jsxgraph width="700" height="500">
<jsxgraph width="700" height="500">


Line 11: Line 14:


brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-2, 100, data.length+2, -70], grid: false, axis:true});
brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-2, 100, data.length+2, -70], grid: false, axis:true});
s = brd.createElement('slider',[[10,70],[100,70],[0,1,1]]);     
s = brd.createElement('slider',[[10,70],[100,70],[0,1,1]],{name:'scale'});     
deg = brd.createElement('slider',[[10,90],[100,90],[1,1,10]],{name:'degree',snapWidth:1});     
deg = brd.createElement('slider',[[10,90],[100,90],[1,1,10]],{name:'degree',snapWidth:1});     
curve = brd.createElement('curve',[datax,[]],{strokeColor:'gray',dash:2});     
curve = brd.createElement('curve',[datax,[]],{strokeColor:'gray',dash:2});     

Revision as of 15:10, 19 August 2009

Through the points defining the dashed line the regression polynomial of degree 'degree' is computed and displayed. The points can be scaled by adjusting the slider 'scale'. The degree of the regression polynomial can be changed by using the slider 'degree'.

The underlying JavaScript code