|
Post by meerkat on Jun 21, 2019 9:58:37 GMT -5
Fixed a couple bugs and added a couple features. If you had over 7000 samples in a Multiple Linear Regression analysis it would fail because of excess memory. MLR now only takes the first 5000 samples. Added - Geometric Regression analysis. - Ability to enter your own SQL commands. Good way to test your SQL commands before using them in a program. - The program will generate a program based on your SQL command on request. - Added Speech for some errors and directions. - Added some documentation. - Graphically display MLR, Geometric Regression, and Linear Regression with projected line - Upon request it will validate numeric entries. - Upon request it will display a date/time popup picker for date / time fields. - Upon request it will display a color popup picker for fields that contain the word "color" such as colorId or theColor. Useful info. When trying to see if there is any association of data, it is sometimes useful to do a search first to restrict your samples. For example you can eliminate fields with values below zero with the ">0" search. Or sometimes it's useful to eliminate some large values that skew the line by using the "<12345" search. Screen shot with sample Regression analysys. The dots are the sample, the red line is the generated line equation. ' *********************************************************** ' table maintenance and analysys ' *********************************************************** CSSClass ".extBtn", "{background-color:pink;}" bf$ = "<SPAN STYLE='font-family:Arial; font-weight:700; font-size:12pt'>" ' set your favoriate font and size here fweb$ = "<SPAN STYLE='font-family:Webdings; font-weight:700; font-size:10pt'>" ' set your favoriate font and size here tab$ = chr$(9) title$ = "Database Table Maintenance and Analysys" ' Set your color scheme here clrHdr$ = "wheat" ' Header clrBkg$ = "#F9E79F" ' Bachground clr0bg$ = "#FCF3CF" ' Even line color clr1bg$ = "#FEF9E7" ' Odd Line color clrTbl$ = "brown" ' Table border color
' graph colors gClr$ = "green,yellow,pink,cyan,purple,darkCyan,darkGreen,blue,darkMagenta,olive,orange,salmon,springGreen,brown,red"
' ---------------------------------- ' select a db and get the table ' ---------------------------------- [load] where$ = "" ' clear any previous where drill downs orderBy$ = "" ' clear any previous sorts cls speak$ = "Select a data base" ' Speak this gosub [speak] upload "Select Database"; db$ speak$ = "Thank you" ' tell it to speak nothing gosub [speak] if db$ = "" then end open db$ for input as #1 ' open the database file sz = lof(#1) ' the size of the file a$ = "?" ' set input area a$ to ? if sz > 12 then line input #1, a$ ' the file size has to be greater than 12 close #1 a$ = left$(a$,13) ' get the first 13 characters. If less than 12 it is ? if lower$(a$) <> "sqlite format" then ' does the file have the right header for a SQLite file cls print "Database:";db$;" is not a SQLite file" speak$ = "This file ";db$;" is not S Q L light format" gosub [speak] wait end if ' ----------------- connect to requested db ---------------- sqliteconnect #sql, db$ ' Connect to the db sql$ = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name" errMsg$ = "could be sql error:";sql$ ' not sure exactly what the error is, so simply show the sql command on error goto [oops] #sql execute(sql$) rows = #sql ROWCOUNT() ' Get the number of tables in the db if rows < 1 then ' what the hell... No tables?? cls print "There are no tables in database ";db$ speak$ = "There are no tables in database ";db$ gosub [speak] end end if print "There are ";rows;" tables in ";db$ speak$ = "There are ";rows;" tables in database ";db$ gosub [speak] button #go, "GO", [go] html " " button #ex, "EXIT", [exit] #ex cssclass("extBtn") html "<BR><SELECT name='tbl' size=";rows;">" ' make a drop down for user table selection for i = 1 to rows #row = #sql #nextrow() tbl$ = #row name$() html "<option value='";tbl$;"'>";tbl$;"</option>" next i html "</select><BR>" wait
' -------------------------------- ' Table selected ' ready to rock and roll ' -------------------------------- [go] tblName$ = #request get$("tbl") if tblName$ = "" then print "No table selected" wait end if sql$ = "PRAGMA table_info(";tblName$;")" ' returns cid|name|type|notnull|dflt_value|pk #sql execute(sql$) ' numFlds = #sql ROWCOUNT() ' Get the number of fields in the db colNames$ = "" ' comma seperated column names fldNames$ = "" ' comma seperated field names dim fldName$(numFlds) ' field name array dim fldType$(numFlds) ' field type array dim fldSize$(numFlds) ' field size array dim fldDefSize$(numFlds) ' field default defined size array dim fldSize(numFlds) ' field size array numeric dim fldDecm$(numFlds) ' field number of decimals array dim colSize(numFlds) ' list column size array dim qrFld$(numFlds) ' area to mark QR bar code for i = 1 to numFlds ' go through the sql result list result$ = #sql nextrow$(" |") ' seperate fields with "blank |" fldName$(i) = word$(result$,2," |") ' next field name fldNames$ = fldNames$ + "," + fldName$(i) ' gather field names into fldNames$ colNames$ = colNames$ +"," + fldName$(i) + "))" ' gather field names into colNames$ a$ = word$(result$,3," |") + "( )" ' next info into a$ fldType$(i) = word$(a$,1,"(") ' split a$ apart a$ = word$(a$,2,"(") ' a$ = word$(a$,1,")") if instr(a$,",") then ' see if it has decimals fldSize$(i) = word$(a$,1,",") ' the size of the field fldDecm$(i) = word$(a$,2,",") ' number of decimals in the field else fldSize$(i) = a$ ' no decimals so just use the field size end if fldDefSize$(i) = trim$(fldSize$(i)) ' the defined size of the filld fldType$(i) = upper$(fldType$(i)) ' what type of field fldTypes$ = fldTypes$ + cma$ + fldType$(i) ' gather field types in fldTypes if fldType$(i) = "TEXT" then fldSize$(i) = "40" ' if TEXT type give it a size of 40 if fldType$(i) = "DATE" then fldSize$(i) = "10" ' if DATE type give it a size of 10 if trim$(fldSize$(i)) = "" then fldSize$(i) = "10" ' if no size give it a size of 1- if val(fldSize$(i)) < 4 then fldSize$(i) = "4" ' use size 4 as minimum size if val(fldSize$(i)) > 30 then fldSize$(i) = "30" ' use size 30 as maximum size fldSize(i) = val(fldSize$(i)) ' hold size in fldSize array colSize(i) = min(20,fldSize(i)) next i numRecords = 0
' ------------------------------------------- ' user want date and/or numeric checks ' ------------------------------------------- cls vdt$ = " " html bf$ html "<input type='checkbox' name='dteChk' value='Y'/>Validate Dates including color picker<br>" html "<input type='checkbox' name='clrChk' value='Y'/>Color Picker for field names that contain 'color'<br>" html "<input type='checkbox' name='numChk' value='Y'/>Validate Numeric<br>" html "<input type='checkbox' name='shoFld' value='Y'/>Show Field Definitions<br>" button #go, "Continue",[doChks]
wait [doChks] dteChk$ = #request get$("dteChk") clrChk$ = #request get$("clrChk") numChk$ = #request get$("numChk") shoFld$ = #request get$("shoFld")
' ================================================= ' List table detail ' ================================================= [list] ' ------------------------------------------------ ' how many records ' ------------------------------------------------ cls dim x(1) ' clear dims to free up memory dim s(1) dim t(1) dim a(1)
on error goto [oops] ' catch all errors if numRecords = 0 then ' if numRecords is zero then find out how many records sql$ = "SELECT count(*) as numRecords FROM ";tblName$ + where$ + groupBy$ #sql execute(sql$) #row = #sql #nextrow() numRecords = #row numRecords() end if gosub [hdng] ' display heading and message area
' ------------------------------------------------------------- ' Record Heading ' ------------------------------------------------------------- html bf$;"<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>" html "<TR><TD></TD><TD></TD></TR><TR><TD valign=top>"
' -------------------------------------- ' detail screen with option buttons ' -------------------------------------- html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 bordercolor=";clrTbl$;" bgcolor=";clr1bg$;">" html "<TR><TD align=left colspan=2>" html "<A title='Add a Record'>" :button #add, "ADD", [add] html "</A><A title='Change a Record'>" :button #chg, "CHG", [chg] html "</A><A title='Delete a Record'>" :button #del, "DEL", [del] html "</A><A title='Gimme some help.. Please!'>" :button #hlp, "HLP", [hlp] html "</A><BR>" html "</A><A title='SQL command'>" :button #xql, "SQL", [sql] html "</A><A title='CSV Out Comma Seperated Variable file Output'>" :button #csv, "CSVo", [csvO] html "</A><A title='CSV In Comma Seperated Variable file Input'>" :button #csv, "CSVi", [csvI] html "</A><A title='Clear detail input'><input type='reset' value='CLR'>" html "</A><BR>" html "<A title='Select and execute requested sort'>" :button #srt, "Sort", [sort] html "</A><A title='Select and execute requested Groups'>" :button #grp, "Grup", [grup] html "</A><A title='QR code on selected fields. Enter pixels high'>" :button #sch, "QRcd", [qrcd] html "</A><A title='Select and execute requested Search'>" :button #sch, "Srch", [src] html "<BR>" html "</A><A title='Multiple Linear Regression of selected points'>" :button #mlr, "MLR", [mlr] html "</A><A title='Linear regression of X and Y points'>" :button #lnr, "Lenr", [lenr] html "</A><A title='Curvilinear Interpolation of X and Y points'>" :button #cin, "CLnr", [cint] html "</A><A title='Geometric Regression of X and Y points'>" :button #ger, "GeRg", [gerg] html "</A>" html "</TD></TR>" for i = 1 to numFlds html "<TR><TD bgcolor=";clrHdr$;" align=right>";fldName$(i);"</TD><TD>" typ$ = "text" if clrChk$ = "Y" and instr(lower$(fldName$(i)),"color") > 0 then typ$ = "color" if dteChk$ = "Y" then ' is it a date or time field if instr(fldType$(i),"DATE") > 0 then typ$ = "date" if instr(fldType$(i),"TIME") > 0 then typ$ = "time" if instr(fldType$(i),"DATETIME") > 0 then typ$ = "datetime-local" end if if numChk$ = "Y" then ' is it a number type field if instr(fldType$(i),"INT") > 0 then typ$ = "number" if instr(fldType$(i),"FLOAT") > 0 then typ$ = "number" if fldType$(i) = "DECIMAL" then typ$ = "number" end if 'mediaPath$ = "../"media/" 'if instr(lower$(fldName$(i)),"photo") > 0 then 'html "<img SRC=""" + mediaPath$ + val$ + """ height=50>" 'goto [nxtDtl] 'end if if fldType$(i) = "TEXT" then html "<textarea name='";fldName$(i);"' id='";fldName$(i);"' rows=4 cols=35></textarea>" else html "<input type='";typ$;"' name='";fldName$(i);"' id='";fldName$(i);"' value='' size=";fldSize$(i);"/>" end if if shoFld$ = "Y" then ' show field definition html fldType$(i) if fldDefSize$(i) <> "" then html "(";fldDefSize$(i) if fldDecm$(i) <> "" then html ",";fldDecm$(i) html ")" end if end if [nxtDtl] html "</TD></TR>" next i html "<TR><TD BGCOLOR=red id=errMsg></TD></TR>" html "</TABLE>" html "</TD><TD valign=top>"
' -------------------------------- ' list table data ' -------------------------------- html "<script> document.getElementById('errMsg').innerHTML = '";errMsg$;"';</script>" 'the message area html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 bordercolor=";clrTbl$;" width=100%>" html "<TR bgcolor=";clrBkg$;" align=center valign=bottom>" html "<TD valign=middle><FONT FACE=Webdings>";chr$(157);"</FONT></TD>" for i = 1 to numFlds ' heading names colName$ = left$(fldName$(i),colSize(i)) if len(fldName$(i)) > colSize(i) then colName$ = colName$ + "<BR>" + mid$(fldName$(i),colSize(i)+ 1,colSize(i)) html "<TD>";colName$;"</TD>" next i html "</TR>"
if sumAvg$ <> "" then a$ = sumAvg$ ' if user ask for group the use sum of field names that are numeric else a$ = ",";tblName$;".*" ' else just use all(*) the field names end if
sql$ = "SELECT ";tblName$;".rowid as rowid";a$;" FROM ";tblName$ + where$ + groupBy$ + orderBy$ + limit$ ' create sql with users where and/or group and/or sort dispLine = 0 #sql execute(sql$) WHILE #sql hasanswer() a$ = #sql nextrow$(" |") dispLine = dispLine + 1 if dispLine AND 1 then html "<TR BGCOLOR=";clr0bg$;">" else html "<TR BGCOLOR=";clr1bg$;">" end if html "<TD align=center>" rowid$ = word$(a$,1,"|") html "<A title='View Record detail'>" button #vue, "", [shoDtl] #vue setkey(rowid$) html "</A></TD>" for i = 1 to numFlds ' fro each field we already know fs = fldSize(i) ' - the size ft$ = fldType$(i) ' - the type val$ = word$(a$,i+1,"|") ' get the value of the field val$ = left$(val$,20) if qrFld$(i) <> "" then html "<td><img src='https://api.qrserver.com/v1/create-qr-code/?data=";val$;"&size=";qrFld$(i);"x";qrFld$(i);"' title='";val$;"'/></td>" else alin$ = "" if instr("INTEGER DECIMAL FLOAT SMALLINT",ft$) then alin$ = "align=right" ' align numeric to the right if fs < 5 then alin$ = "align=center" ' if size less then 5 then center it html "<TD ";alin$;">";val$;"</TD>" end if next i html "</TR>" WEND html "</TABLE>" html "</TD></TR><TR></TABLE>" wait
' ------------------------------------ ' show selected record detail ' ------------------------------------ [shoDtl] html "<script> document.getElementById('errMsg').innerHTML = '";errMsg$;"';</script>" 'clear the message area thisRowid$ = EventKey$ sql$ = "SELECT * FROM ";tblName$;" WHERE ";tblName$;".rowid = ";thisRowid$ #sql execute(sql$) h$ = "<script>" ' start script to place data in form hold area for each field a$ = #sql nextrow$(" |") ' seperate fields with "blank |" for i = 1 to numFlds ' split out each field val$ = trim$(word$(a$,i,"|")) ' value of next field val$ = strRep$(val$,"'","\'") ' escape the single quote val$ = strRep$(val$,"""","\""") ' escape the quote val$ = strRep$(val$,chr$(10)," ") ' line feed to space val$ = strRep$(val$,chr$(13)," ") ' carriage return to space h$ = h$ + "document.getElementById('";fldName$(i);"').value = '";val$;"';" ' place data in form hold area next i html h$;"</script>" wait
' ------------------------------------- ' delete a record ' ------------------------------------- [del] ' Delete selected record input "Are you sure you want to delete this (y/n)";y$ if lower$(trim$(y$)) <> "y" then wait ' user decides not to delete so simply wait for something else to do sql$ = "DELETE FROM ";tblName$;" WHERE rowid = '";thisRowid$;"'" #sql execute(sql$) numRecords = 0 ' at 0 this switch forces it to recount and sql new data since one was deleted goto [list]
' --------------------------------- ' add a record ' --------------------------------- [add] vals$ = "" sep$ = "'" for i = 1 to numFlds ' gether all the fields and seperate them into vals$ vals$ = vals$ + sep$ + dblQuote$(#request get$(fldName$(i))) sep$ = "','" next i vals$ = vals$ + "'" sql$ = "INSERT INTO ";tblName$;" VALUES(";vals$;")" ' insert the gathered vals into the db errMsg$ = "Could be sql error ";sql$ ' message for error #sql execute(sql$) ' execute the sql numRecords = 0 ' set record count to zero forces the [list] to get new count goto [list] ' get a new list of data
' -------------------------------------------------- ' Change selected record ' -------------------------------------------------- [chg] sep$ = "" sql$ = "" for i = 1 to numFlds sql$ = sql$ + sep$ + fldName$(i) + " = '" + dblQuote$(#request get$(fldName$(i))) + "'" sep$ = ",";chr$(13) next i sql$ = "UPDATE ";tblName$;" SET " ; sql$ ; chr$(13);" WHERE rowid = ";thisRowid$ errMsg$ = "** ERROR ** Cannot change.. Make sure you have correct key values" #sql execute(sql$) goto [list]
' ---------------------------- ' sort ' ---------------------------- [sort] dim srt$(numFlds) selFlds$ = "" orderBy$ = "" groupBy$ = "" sumAvg$ = "" for i = 1 to numFlds a$ = lower$(#request get$(fldName$(i))) a = val(a$) if group$ = "g" then if instr(a$,"a") + instr(a$,"s") = 0 then sumAvg$ = sumAvg$ + "," + fldName$(i) if instr(a$,"a") then sumAvg$ = sumAvg$ + "," + "avg(";fldName$(i);") as ";fldName$(i) if instr(a$,"s") then sumAvg$ = sumAvg$ + "," + "sum(";fldName$(i);") as ";fldName$(i) end if srt$(a) = srt$(a) + "," + fldName$(i) if lower$(right$(a$,1)) = "d" and group$ <> "g" then srt$(a) = srt$(a) + " desc " next i
for i = 1 to numFlds if srt$(i) <> "" then selFlds$ = selFlds$ + srt$(i) next i
if selFlds$ = "" then sumAvg$ = "" if selFlds$ <> "" then if group$ = "g" then groupBy$ = " GROUP BY ";mid$(selFlds$,2) else orderBy$ = " ORDER BY ";mid$(selFlds$,2) end if end if goto [list]
dim srt$(numFlds) orderBy$ = "" for i = 1 to numFlds a$ = #request get$(fldName$(i)) a = val(a$) srt$(a) = srt$(a) + "," + fldName$(i) if lower$(right$(a$,1)) = "d" then srt$(a) = srt$(a) + " desc " next i
for i = 1 to numFlds if srt$(i) <> "" then orderBy$ = orderBy$ + srt$(i) next i orderBy$ = " ORDER BY ";mid$(orderBy$,2) goto [list]
' --------------------------------- ' options ' --------------------------------- [vdte] vdt$ = "X" wait ' --------------------------------- ' SQL command ' --------------------------------- [sql] qry$ = "SELECT * FROM ";tblName$ + where$ + groupBy$ + orderBy$ + " LIMIT 0,20" cls html bf$;"<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 bordercolor=";clrTbl$;" bgcolor=";clr1bg$;">" html "<TR><TD ALIGN=CENTER BGCOLOR=";clrHdr$;" ALIGN=CENTER>Database:";db$;"</TD></TR><TR><TD>" html "<TEXTAREA NAME='sqlCmd' ROWS=20 COLS=90 ID=query>";qry$;"</TEXTAREA>" html "</TD></TR><TR><TD>" html "On SELECTS if you do not specify a LIMIT the system defaults to LIMIT 0,20<BR>" html "Remember that SQL commands will not allow double qoutes (") only single quotes (')<BR>" html "If you do multiple INSERTS or CREATES seperate each statement with semicolons (;)</TD></TR>" html "<TR><TD ALIGN=CENTER BGCOLOR=";clrHdr$;">"
CHECKBOX #full, "Full List ", 0
button #queryExec, "Execute", [SQLExec] #queryExec cssclass("sBtn") html " " button #exit, "Exit", [list] #exit cssclass("extBtn") html "</TD></TR></TABLE></CENTER>" wait ' --------------------------------- ' Execute query statements ' --------------------------------- [SQLExec] on error GOTO [queryBad] sql$ = #request get$("sqlCmd") sql$ = trim$(sql$) if sql$ = "" then wait
' Not a select statement then see if there is more if lower$(left$(sql$,6)) <> "select" then a1$ = sql$ + ";_END_;" while instr(a1$," ") > 0 a1$ = strRep$(a1$," "," ") wend ii = 1 while word$(a1$,ii,";") <> "_END_" sql$ = trim$(word$(a1$,ii,";")) if asc(sql$) < 14 then sql$ = mid$(sql$,1) print sql$ p0 = 1 p3$ = "" while word$(sql$,p0,chr$(10)) <> "" p1$ = word$(sql$,p0,chr$(10)) p0 = p0 + 1 a$ = trim$(p1$) if left$(a$,1) <> "#" then p3$ = p3$ + p1$ + " " end if WEND sql$ = trim$(p3$) if len(sql$) > 7 then #sql execute(sql$) ii = ii + 1 WEND print "---------------- SQL Complete ------------------------" on error goto [oops] wait end if
#sql execute(sql$) rows = #sql ROWCOUNT() 'Get the number of rows colNames$ = #sql columnnames$() colNames$ = strRep$(colNames$," ","") fldNames$ = colNames$ nc = 0 i = 1 while i <> 0 i = instr(colNames$,",",i+1) nc = nc + 1 wend colNames$ = strRep$(colNames$,",","</td><td>") numRows = 0 cls fullList = #full value() html bf$ html "<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0>" html "<TR BGCOLOR=";clrHdr$;" ALIGN=CENTER><TD colspan=";nc;"> Database:";db$;"</TD></TR>" html "<TR align=center BGCOLOR=";clrHdr$;"><TD>";colNames$;"</TD></TR>"
WHILE #sql hasanswer() result1$ = #sql nextrow$(" ~|") sep$ = "<TR>" for i = 1 to nc a$ = trim$(word$(result1$,i,"~|")) if fullList = 0 then a$ = left$(a$,12) ' only first 12 characters please html sep$;"<TD ";wordWrap$;">";a$ ' if larger than cell then force it to word wrap sep$ = "</TD>" next i html "</TD></TR>" numRows = numRows + 1 ' bump the number of rows if numRows > 50 then goto [queryExit] ' stop at 50 just in case they accidently ask for infinity WEND [queryExit] html "<TR BGCOLOR=";clrHdr$;" align=center><TD colspan=";nc;">" button #queryGen, "Gen RB Code", [SQLgen] html " " button #query, "SQL", [sql] html " " button #exit, "Exit", [list] #exit cssclass("extBtn") html "</TD></TR></TABLE>" wait
[SQLgen] a$ = lower$(trim$(sql$)) if left$(a$,6) <> "select" then print "Can only generate Run Basic Code on SELECT queries" wait end if html "<HR><CENTER>Copy and past the following code</center><HR>" print "dbName$ = """;db$;"""" print "sqliteconnect #sql, """;db$;"""" print "sql$ = """;sql$;"""" print "#sql execute(sql$)" print "rows = #sql ROWCOUNT() 'Get the number of rows" print "colNames$ = #sql columnnames$()" print "colHdng$ = """"" print "sep$ = ""<TR align=center BGCOLOR=lightgray><TD>""" print "nc = 1" print "while word$(colNames$,nc,"","") <> """"" print " colHdng$ = colHdng$ + sep$ + word$(colNames$,nc,"","")" print " nc = nc + 1" print " sep$ = ""</TD><TD>""" print "WEND"
print "nc = nc - 1" print "cls" print "html ""<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0>""" print "html ""<TR BGCOLOR=lightgray ALIGN=CENTER><TD colspan="";nc;"">Database:"";dbName$;""</TD></TR>"";colHdng$;""</TD></TR>""" print "WHILE #sql hasanswer()" print " #row = #sql #nextrow()" for i = 1 to nc fieldName$ = trim$(word$(fldNames$,i,",")) print fieldName$;"$ ";tab$;"= #row ";fieldName$;"$()" next i
print "html ""<TR>""" for i = 1 to nc fieldName$ = trim$(word$(fldNames$,i,",")) print "html ""<TD>"";";fieldName$;"$;""</TD>""" next i print "html ""</TR>""" print "WEND" print "html ""</TABLE>""" print "#sql disconnect()" print "wait" wait
[queryBad] print "*** Error *** ";Err$ wait
' ------------------------------------------- ' Multiple Linear Regression ' ------------------------------------------- [mlr] errMsg$ = "Multiple Linear Regression" gosub [doMsg] v = 0 dim thisFld$(numFlds) flds$ = "" for i = 1 to numFlds a$ = lower$(#request get$(fldName$(i))) a = val(a$) if a <> 0 then if thisFld$(a) <> "" then errMsg$ = "Sequence ";a;" already used" print errMsg$ gosub [doMsg] wait end if thisFld$(a) = fldName$(i) v = v + 1 end if next i for i = 1 to numFlds if thisFld$(i) <> "" then flds$ = flds$ + "," + thisFld$(i) if i = v then x$ = "<FONT COLOR=red> D" else x$ = "<FONT COLOR=";word$(gClr$,i,",");">Ind" end if html x$;"ependent Variable ";thisFld$(i);"<BR>" end if next i html "<FONT COLOR=black>" ' turn off <font color> v1 = v v = v -1 if v < 2 then errMsg$ = "Must have at least 2 independent variables" print errMsg$ gosub [doMsg] wait end if
print ' -------------------------------------- ' get minimum and max values ' -------------------------------------- dim minVal(v1) dim maxVal(v1) dim avgVal(v1) ' ----- get minimum values x$ = strRep$(flds$,",","+0),min(") + "+0)" sql$ = "SELECT ";mid$(x$,5);" FROM ";tblName$ + where$ + " LIMIT 0,5000" #sql execute(sql$) rows = #sql ROWCOUNT() 'Get the number of rows selected result$ = #sql nextrow$(" |") for j = 1 to v1 minVal(j) = val(word$(result$,j,"|")) next j x$ = strRep$(flds$,",","+0),max(") + "+0)" ' ------ get maximum values sql$ = "SELECT ";mid$(x$,5);" FROM ";tblName$ + where$ + " LIMIT 0,5000" #sql execute(sql$) rows = #sql ROWCOUNT() 'Get the number of rows result$ = #sql nextrow$(" |") for j = 1 to v1 maxVal(j) = val(word$(result$,j,"|")) if maxVal(j) = 0 then maxVal(j) = 1 ' prevent division by zero print word$(flds$,j+1,",");tab$;" min:";minVal(j);tab$;" max:";maxVal(j) next j ' ------ produce graph of average percent avgTot = 0 x$ = strRep$(flds$,",","+0),avg(") + "+0)" sql$ = "SELECT ";mid$(x$,5);" FROM ";tblName$ + where$ + " LIMIT 0,5000"
#sql execute(sql$) rows = #sql ROWCOUNT() 'Get the number of rows result$ = #sql nextrow$(" |") for j = 1 to v1 avgVal(j) = val(word$(result$,j,"|")) avgTot = avgTot + avgVal(j) next j
html bf$;"<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 WIDTH=70% bgcolor=lightgray>" html "<TR ALIGN=CENTER BGCOLOR=silver><TD WIDTH=20%>Field Name</TD><TD>Average Value</TD></TR>" for j = 1 to v1 pcnt = (avgVal(j) * 100) / avgTot html "<TR><TD BGCOLOR=silver ALIGN=RIGHT>";word$(flds$,j +1,",");"</TD><TD>" html "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=";pcnt;"%>" html "<TR><TD BGCOLOR=";word$(gClr$,j,",");">";avgVal(j);"</TD></TR></TABLE></TD></TR>" next j html "</TABLE></TD></TR></TABLE>"
print "-------------------------------------------------" ' ------------------------------------
sql$ = "SELECT ";mid$(flds$,2);" FROM ";tblName$ + where$ + orderBy$ + " LIMIT 0,5000" #sql execute(sql$) rows = #sql ROWCOUNT() 'Get the number of rows n = rows gPrint = rows / 100 gPrint = int(gPrint + .9) gPrint = max(1,gPrint)
[numPoints] print "Number of points:";n print "print graphic for every ";gPrint;" records" if n = 5000 then Print "Because of memory the sample is limited to 5000" dim x(n + 2) dim s(n + 1) dim t(n + 1) dim a(n + 1, n + 2)
print "Number of known variables:";v if v > n then errMsg$ = "Number of variables cannot exceed the number of known points" print errMsg$ gosub [doMsg] wait end if wth = 1000 / (v + 1) x(1) = 1 for i = 1 to n result$ = #sql nextrow$(" |") html "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR>" if n mod 500 = 0 then errMsg$ = "Working... Number:";n gosub [doMsg] end if for j = 1 to v xx = val(word$(result$,j,"|")) x(j+1) = xx 'print j;" ";xs;" min";minVal(j);" max";maxVal(j) if i mod gPrint = 0 then ' we only want to show 100 points w = xx / maxVal(j) * wth html "<TD height=3 width=";w;" bgcolor=";word$(gClr$,j,",");"></TD>" end if next j xx = val(word$(result$,v+1,"|")) x(v+2) = xx if i mod gPrint = 0 then ' we only want to show 100 points j = j + 1 'print j;">";xx;" min";minVal(j);" max";maxVal(j) w = xx / maxVal(j) * wth html "<TD height=3 width=";w;" bgcolor=red></TD>" html "</tr></TABLE>" end if ' Populate a matrix to be used in curve fitting for k = 1 to v + 1 for l = 1 to v + 2 a(k,l) = a(k,l) + x(k) * x(l) s(k) = a(k,v + 2) next l next k s(v + 2) = s(v + 2) + x(v + 2) ^ 2 next i
' ---------------------------------------------- ' fit curve by solving ' the system of linear equations in matrix a() ' ---------------------------------------------- for i = 2 to v + 1 t(i) = a(1,i) next i
for i = 1 to v + 1 j = i [a300] if a(j,i) <> 0 then goto [a340] j = j + 1 if j <= v + 1 then goto [a300] print "No unique solution" input "Continue ";x$ goto [list] [a340] for k = 1 to v + 2 b = a(i,k) a(i,k) = a(j,k) a(j,k) = b next k z = 1 / a(i,i) for k = 1 to v + 2 a(i,k) = z * a(i,k) next k for j = 1 to v + 1 if j <> i then z = 0 - a(j,i) for k = 1 to v + 2 a(j,k) = a(j,k) + z * a(i,k) next k end if next j next i
print "Equation coefficients" print " Constant = ";a(1,v + 2) for i = 2 to v + 1 print "Variable(";i - 1;") ";word$(flds$,i,",");" = ";a(i,v + 2) next i p = 0 for i = 2 to v + 1 p = p + a(i,v + 2) * (s(i) - t(i) * s(1) / n) next i r = s(v + 2) - s(1) ^ 2 / n z = r - p l = n - v - 1 print i = p / r i = abs(i) print "Coefficent of determination (r^2) = ";i print "coefficient of multiple correlation = ";sqr(i) on error goto [mlrErr] print "standard error of estimate = ";sqr(abs(2 / l))
' Estimate dependent variable from entered independent variables [inpLoop] print "Interpolation (0 to end)"
p = a(i,v + 2) for j = 1 to v print "value of variable ";j;" ";word$(flds$,j+1,","); :input x if x = 0 then goto [list] p = p + a(j + 1,v + 2) * x next j print "Dependent variable "; word$(flds$,v +2,",");" = ";p print goto [inpLoop]
' error message division by zero [mlrErr] print chr$(7);" Invalid data - division by zero" input "Continue ";x$ goto [list]
' ------------------------------------ ' get exactly 2 user input ' points for analysis ' ------------------------------------ [get2pt] dim srt$(numFlds) flds$ = "" n = 0 for i = 1 to numFlds a$ = lower$(#request get$(fldName$(i))) a = val(a$) if a > 0 then srt$(a) = fldName$(i) n = n + 1 a$ = "Field ";fldName$(i);" Selected for " if n = 1 then print a$;"X" else print a$;"Y" end if end if next i if n <> 2 then errMsg$ = "Need exactly 2 points for X and Y" print errMsg$ html "<script> document.getElementById('errMsg').innerHTML = '";errMsg$;"';</script>" errMsg$ = "" RETURN end if for i = 1 to numFlds if srt$(i) <> "" then flds$ = flds$ + "," + srt$(i) end if next i RETURN
' ------------------------------ ' linear regression ' ------------------------------ [lenr] print "Linear Regression" errMsg$ = "Linear Regression" gosub [doMsg] gosub [get2pt] if n <> 2 then input "Continue:";a$ goto [list] end if
j = 0 k = 0 l = 0 m = 0 r2 = 0
flds$ = mid$(flds$,2)
' get the minimum and maximum values for x and y minMax$ = "" for i = 1 to 2 minMax$ = minMax$ + ",min(" ; word$(flds$,i,",") + ")" + ",max(" ; word$(flds$,i,",") + ")" next i
sql$ = "SELECT ";mid$(minMax$,2);" FROM ";tblName$ + where$ #sql execute(sql$) result$ = #sql nextrow$(" |") minx = val(word$(result$,1,"|")) maxx = val(word$(result$,2,"|")) miny = val(word$(result$,3,"|")) maxy = val(word$(result$,4,"|"))
print "min x ";word$(flds$,1,",");" = ";minx print "max x ";word$(flds$,1,",");" = ";maxx print "min y ";word$(flds$,2,",");" = ";miny print "max y ";word$(flds$,2,",");" = ";maxy
if where$ <> "" then print "Selection restricted ";where$ else print "Selection of all records" end if ' --------- show graph graphic #g, 400,400 #g size(2) 'pen size #g line(000,000,000,400) #g line(000,000,400,000) #g line(400,400,400,000) #g line(000,400,400,400)
' ------ sql select coordinate points sql$ = "SELECT ";flds$;" FROM ";tblName$ + where$ + " ORDER BY ";flds$ #sql execute(sql$) rows = #sql ROWCOUNT() 'Get the number of rows n = rows gpoints = rows / 400 print "Graph points:";gpoints print "Number of records = ";n for i = 1 to n result$ = #sql nextrow$(" |") x = val(word$(result$,1,"|")) y = val(word$(result$,2,"|")) px = int((x / maxx) * 400) ' plot points on graph py = int((y / maxy) * 400) if px + py > 0 then #g place(px,py) #g circle(2) end if j = j + x k = k + y l = l + x ^ 2 m = m + y ^ 2 r2 = r2 + x * y next i
' --- compute curve coefficient b = (n * r2 - k * j) / (n * l - j ^2) a = (k - b * j) / n print "f(x) = ";a;" + (";b;" * x)"
' --- compute regression analysis j = b * (r2 - j * k / n) m = m - k ^ 2 / n k = m - j
on error goto [lpErr] r2 = j / m print "Coefficient of Determination (r^2) = ";r2 print "Coefficient of Correlation = ";sqr(r2) print "Standard error of estimate = ";sqr(k / (n-2)) print print "Interpolation (enter 0 to end)"
#g color("red") y1 = int(((a + b * minx) / maxy) * 400) y2 = int(((a + b * maxx) / maxy) * 400) x1 = int((minx / maxx) * 400) x2 = 400 #g size(3) 'pen size #g line(x1,y1,x2,y2) print "(";minx;",";miny;")" render #g print "(";maxx;",";maxy;")" print
[lpLoop] input "Enter value of x";x if x = 0 then goto [list] print "Estimate for y = ";a + b * x print goto [lpLoop]
[lpPoints] print "Need more than 2 points to calculate standard error of estimate" wait
' --- divisi'on errors [lpErr] print "Coefficient of determination and coefficient of correlation" print "Cannot be determined" on error goto [oops] wait
' -------------------------------------- ' Geometric Regression ' -------------------------------------- [gerg] print "Geometric Regression" errMsg$ = "Geometric Regression" gosub [doMsg] gosub [get2pt] if n <> 2 then input "Continue:";a$ goto [list] end if on error goto [gergErr] flds$ = mid$(flds$,2)
' get the minimum and maximum values for x and y minMax$ = "" for i = 1 to 2 minMax$ = minMax$ + ",min(" ; word$(flds$,i,",") + ")" + ",max(" ; word$(flds$,i,",") + ")" next i
sql$ = "SELECT ";mid$(minMax$,2);" FROM ";tblName$ + where$ #sql execute(sql$) result$ = #sql nextrow$(" |") minX = val(word$(result$,1,"|")) maxX = val(word$(result$,2,"|")) minY = val(word$(result$,3,"|")) maxY = val(word$(result$,4,"|"))
print "min X ";word$(flds$,1,",");" = ";minX print "max X ";word$(flds$,1,",");" = ";maxx print "min Y ";word$(flds$,2,",");" = ";miny print "max Y ";word$(flds$,2,",");" = ";maxy
if where$ <> "" then print "Selection restricted ";where$ else print "Selection of all records" end if
print "Geometric Regression" print J = 0 K = 0 L = 0 M = 0 R2 = 0
sql$ = "SELECT ";flds$;" FROM ";tblName$ + where$ + " ORDER BY ";flds$ #sql execute(sql$) rows = #sql ROWCOUNT() 'Get the number of rows print "rows:";rows N = rows gpoints = rows / 400 print "Graph points:";gpoints print "Number of records = ";N ' --------- show graph graphic #g, 400,400 #g size(2) 'pen size #g line(000,000,000,400) #g line(000,000,400,000) #g line(400,400,400,000) #g line(000,400,400,400)
for i = 1 to N result$ = #sql nextrow$(" |") X = val(word$(result$,1,"|")) Y = val(word$(result$,2,"|")) px = int((X / maxX) * 400) ' graph point x py = int((Y / maxY) * 400) ' graph point y 'print i;tab$;X;tab$;Y;tab$;px;tab$;py if px + py > 0 then #g place(px,py) #g circle(2) end if ' accumulate intermediate values Y = log(Y) X = log(X) J = J + X K = K + Y L = L + (X * X) M = M + (Y * Y) R2 = R2 + (X * Y) next i ' calculate coefficents B = ((N * R2) - (K * J)) / ((N * L) - (J * J)) A = (K - (B * J)) / N print "A:";A print "B:";B [fx] print "f(X) = ";exp(A);" *X^";B ' calculate regression analysis J = B * (R2 - J * K / N) M = M - K^2 / N K = M - J R2 = J / M print print "Coefficient of" print "Determination (r^2) = ";R2 print "Coefficient of" print "Correlation = ";sqr(R2) print print "Standard error of estimate = ";sqr(K / (N -2)) print ' estimate Y-Coordinate from entered X-coordinage print "Interpolation (0 to end)" #sql execute(sql$)
' --- rerun selection with computed value #g color("red") #g size(3) 'pen size ppx = 0 ppy = 0 for i = 1 to N result$ = #sql nextrow$(" |") X = val(word$(result$,1,"|")) Y = val(word$(result$,2,"|")) Y = exp(A) * X^B px = int((X / maxX) * 400) py = int((Y / maxY) * 400) 'print i;tab$;X;tab$;Y;tab$;px;tab$;py if px + py <> 0 then #g line(ppx,ppy,px,py) ppx = px ppy = py end if next i print "(";minX;",";minY;")" render #g print "(";maxX;",";maxY;")"
[tryX] input "Value of X:";X if X = 0 then goto [list] print tab$;tab$;"Y = ";exp(A) * X^B goto [tryX]
' divison by zero or something bad... [gergErr] errMsg$ = "Cannot Determine Regression.. Sorry!" print errMsg$ on error goto [oops] gosub [doMsg] wait
' -------------------------------------- ' Curvilinear Interpolation ' -------------------------------------- [cint] print "Curvilinear Interpolation" gosub [get2pt] if n <> 2 then input "Continue:";a$ goto [list] end if
sql$ = "SELECT ";mid$(flds$,2);" FROM ";tblName$ + where$ #sql execute(sql$) rows = #sql ROWCOUNT() 'Get the number of rows n = rows on error goto [cintErr] print "Number of samples ";n dim x(n) dim y(n) for i = 1 to n result$ = #sql nextrow$(" |") x(i) = val(word$(result$,1,"|")) y(i) = val(word$(result$,2,"|")) next i [cintLoop] input "Intepolate x = ";a if a = 0 then goto [list] b = 0 for j = 1 to n t = 1 for i = 1 to n if x(j) <> x(i) then t = t * (a - x(i)) / (x(j) - x(i)) next i b = b + t * y(j) next j
print "Result y = ";b goto [cintLoop] [cintErr] errMsg$ = "** Value too large for curvilinear Interpolation calculation" gosub [doMsg] on error goto [oops] wait
' ---------------------------- ' Group by ' ---------------------------- [grup] group$ = "g" ' group by switch numRecords = 0 goto [sort]
' ---------------------------- ' QR code generation ' ---------------------------- [qrcd] dim qrFld$(numFlds) ' qr code switch for selected fields numRecords = 0 for i = 1 to numFlds a = val(#request get$(fldName$(i))) if a > 0 then a = max(20,a) ' at least 20 pixels square a = min(200,a) ' and not to exceed 200 qrFld$(i) = str$(a) end if next i goto [list]
' --------------------------------------------- ' User Search screen ' Change srchFields$ for allowed search fields ' --------------------------------------------- [src] where$ = "" an$ = "" for i = 1 to numFlds a$ = trim$(#request get$(fldName$(i))) if a$ <> "" then nt$ = "" not$ = "" if left$(a$,1) = "!" then a$ = mid$(a$,2) nt$ = "!" not$ = " NOT " end if if left$(a$,1) = "*" or right$(a$,1) = "*" then ' LIKE condition if left$(a$,1) = "*" then a$ = "%" + mid$(a$,2) if right$(a$,1) = "*" then a$ = left$(a$,len(a$)-1) + "%" where$ = where$ + an$ + fldName$(i) + not$;" LIKE ('";a$;"')" an$ = " AND " else cond$ = left$(a$,1) a$ = mid$(a$,2) if instr("=><",cond$) = 0 then print "Search condition must have a condition of :*x ends x,x* begins x,*x* has x,= equal,< less than,> greater than." print " And may be preceded with ! for Not condition" input "Continue";y$ errMsg$ = "Search condition must have a condition of :*x ends x,x* begins x,*x* " errMsg$ = errMsg$ + "<BR>has x,= equal,< less than,> greater than." errMsg$ = errMsg$ + "<BR> And may be preceded with ! for Not condition" html "<script> document.getElementById('errMsg').innerHTML = '";errMsg$;"';</script>" errMsg$ = "" wait end if where$ = where$ + an$ + fldName$(i);" ";nt$;cond$;" '";a$;"'" an$ = " AND " end if end if next i if where$ <> "" then where$ = " WHERE " + where$ numRecords = 0 goto [list]
' ---------------------------- ' Lines per page ' ---------------------------- [doLpp] if lpp = 0 then lpp = 20 lpp = min(10,lpp) goto [list]
' ---------------------------- ' Next page ' ---------------------------- [doNext] lastPageNum = val(EventKey$) pageNum = val(#pageNum contents$()) if lastPageNum = pageNum then pageNum = pageNum + 1 goto [list]
' ---------------------------- ' Previous page ' ---------------------------- [doPrev] lastPageNum = val(EventKey$) pageNum = val(#pageNum contents$()) if lastPageNum = pageNum then pageNum = pageNum - 1 if pageNum < 1 then pageNum = 1 goto [list]
' ============================================ ' List Heading ' ============================================ [hdng] ' --------------------------------------- ' Did they change the lines per page lpp ' --------------------------------------- x = #lpp ISNULL() if x = 0 then lpp = val(#lpp contents$())
pageNum = max(1,pageNum) ' make user it has a page number if lpp < 1 then lpp = 30 ' lines per page must be specified lpp = max(5,lpp) ' make sure it has a least 5 lines per page lpp = min(100,lpp) ' don not allow over 100 lines per page
totPages = int(numRecords / lpp) if lpp * totPages <> numRecords then totPages = totPages + 1 pageNum = min(totPages,pageNum) pageNum = max(1,pageNum) limitBeg = (pageNum * lpp) - lpp 'limit begin value dispLine = 0 limit$ = " LIMIT " ; limitBeg ; "," ; lpp
html bf$;"<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 WIDTH=100% BGCOLOR=";clrHdr$;">" html "<TR>"
html "<TD ALIGN=center><A title='Load new Database'>" button #lod, "Load", [load] html "</A></TD>"
html "</TD><TD ALIGN=center><A title='Exit the program'>" button #exit, "Exit",[doExit] #exit cssclass("extBtn") html "</A></TD><TD>Records:";numRecords html "</TD><TD>Pages:";totPages html "</TD><TD ALIGN=right><A title='Go to previous page'>" button #prev, "Prev",[doPrev] #prev setkey(pageNum) html "</A></TD><TD width=2%>" TEXTBOX #pageNum, pageNum,2 html "</TD><TD><A title='Go to the next page'>" button #next, "Next",[doNext] #next setkey(pageNum) html "</A><TD ALIGN=right><A title='Lines Per Page'>" button #lpp, "Lpp",[doLpp] html "</A></TD><TD align=left>" TEXTBOX #lpp, lpp,2 html "</TD><TD>";orderBy$;groupBy$ if sumAvg$ <> "" then html "<BR>";sumAvg$ html "</TD><TD>";where$;"</TD></TR></TABLE>" html "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 ><TR><TD BGCOLOR=pink name='errMsg' id='errMsg'></TD></TR></TABLE>" RETURN
' ------------------------------------------- ' CSV Input ' ------------------------------------------- [csvI] ' CSV output speak$ = "Select a C S V file" ' CSV file Input gosub [speak]
errMsg$ = "--------- CSV Input ---------- See at bottom of screen" gosub [doMsg]
upload "CSV Input File"; csvIn$ open csvIn$ for input as #f speak$ = "" gosub [speak] ' say nothing count = 0
errMsg$ = "CSV Input error:";sql$ on error goto [oops]
while not(eof(#f)) count = count + 1 line input #f, a$ a$ = trim$(a$) a$ = strRep$(a$,"'","''") a$ = strRep$(a$,""","," ',") a$ = strRep$(a$,",""",",' ") a$ = strRep$(a$,"""","'") sql$ = "INSERT OR REPLACE INTO ";tblName$;" VALUES (";a$;")" #sql execute(sql$) print sql$ wend close #f wait
' ------------------------------------------- ' CSV Output ' ------------------------------------------- [csvO] ' CSV output outf$ = DefaultDir$;"\public\";tblName$;".csv" errMsg$ = "Output to ";strRep$(outf$,"\","\\") print errMsg$ html "<script> document.getElementById('errMsg').innerHTML = '";errMsg$;"';</script>" errMsg$ = "" open outf$ for output as #1 sql$ = "SELECT * FROM ";tblName$;" ";where$;" ";orderBy$ #sql execute(sql$) rows = #sql ROWCOUNT() 'Get the number of rows for i = 1 to rows a$ = #sql nextrow$(chr$(251)) a$ = strRep$(a$,chr$(34),"'") ' make dbl quotes single quotes a$ = strRep$(a$,chr$(251),chr$(34);",";chr$(34)) ' standard CSV seperator print #1,chr$(34);a$;chr$(34) next i close #1 wait
' ------------------------------------ ' error handling and messages ' ------------------------------------ [oops] print "Error is ";Err$ print "Error number is ";Err errMsg$ = errMsg$ + " Error ";Err$;" Number ";Err html "<script> document.getElementById('errMsg').innerHTML = '";errMsg$;"';</script>" ' place message in form msg hold area errMsg$ = "" speak$ = "Error ";Err$;" Error Number ";err;" Sorry about that" gosub [speak] wait
[doMsg] html "<script> document.getElementById('errMsg').innerHTML = '";errMsg$;"';</script>" ' place message in form msg hold area errMsg$ = "" RETURN
[csvErr] errMsg$ = "** ERROR ** Either the fields do not match the tale or there are duplicate keys" print errMsg$ html "<script> document.getElementById('errMsg').innerHTML = '";errMsg$;"';</script>" errMsg$ = "" wait
' ------------------------------------- ' I could use a little help ' ------------------------------------- [hlp] cls html bf$;"Select a sqlite database, and table. Data Options: You can have the system validate numeric data. You can have the system display a Date Popup for date validation. You can have the system display a color popup for fields with the name color in it somewhare provided it is not defined as numeric or date. For example names like colorId, thisColor, theColor. will be treated as a color field.<HR> <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 WIDTH=100%> <TR><TD>[Sort]</TD><TD>Enter seq numbers, in the order you want, in the fields you want sorted. A 'd' after the number sorts descending</TD></TR> <TR><TD>[Grup] Group</TD><TD>Enter sequence numbers in the order of how you want it grouped. It will List one line per your group</TD></TR> <TR><TD>[QRcd] QR code</TD><TD>Show the QR Code. Enter the size of the displayed code. Minimum is 20, Maximum is 200</TD></TR> <TR><TD>[Srch] (Drill Down)</TD><TD>You can restrict the data listed by entering your search each field <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR> <TD>*x</TD><TD>Find data in that field that ends with "x"</TD></TR> <TR><TD>x*</TD><TD>Find data in that field that begins with "x"</TD></TR> <TR><TD>*x*</TD><TD>Find data in that field that contains a "x"</TD></TR> <TR><TD>>0</TD><TD>Find data in the field that is greater than 0</TD></TR> <TR><TD><0</TD><TD>Find data in the field that is less than 0</TD></TR> <TR><TD>=0</TD><TD>Find data in the field that is equal to 0</TD></TR> <TR><TD COLSPAN=2>Placing a "!" in front of the search is the same as NOT</TD></TR> <TR><TD>!>0</TD><TD>Find data in the field that is Not greater than 0</TD></TR> <TR><TD>!<0</TD><TD>Find data in the field that is not less than 0</TD></TR> <TR><TD>!=0</TD><TD>Find data in the field that is not equal to 0</TD></TR> </TABLE></TD></TR> <TR><TD>[MLR] Multiple Linear Regressioni</TD> <TD>Multiple Linear Regression. This finds the coefficients of multi variables using the method of least squares. You can predict the dependent variable given the variables of the independent variables. It also shows the value of how good the formula is. For example if you had variable of age, height, and weight. If you ask for a correlation of age and height to weight, you could predict the weight given the age and height.</TD></TR> <TR><TD>[Lenr] Linear Regression</TD> <TD>Linear Regression. This fits a straight line to x and y points using the method of least squares. If there is a correlation you can predict values of y for a given x with the supplied equation. It also shows how good the formula is.</TD></TR> <TR><TD>[GeRg] Geometric Regression</TD> <TD>Geometric Regression. This fits a geometric curve to a set of x and y points using the method of least squares. If there is a correlation you can predict values of y for a given x with the supplied equation. It also shows how good the formula is.</TD></TR> <TR><TD>[Clnr] Curvilinear Interpolation</TD> <TD>Curvilinear Interpolation. Compute y coordinates of points on a curve given their x coordinates using the Lagrange interpolation method. The given equation lets you predict values of y given the x value. It aso shows how good the formula is.</TR><TR><TD COLSPAN=2 align=CENTER>" html "</A><A title='I would like to continue with the list'>" :button #lst, "Continue", [list] html "</TD></TR></TABLE>" wait
' ----------------------------------------- ' Get outta here ' ----------------------------------------- [doExit] cls print "Good Bye!" speak$ = "good bye I enjoyed working with you have a great day" gosub [speak] end
' -------------------------------- ' string replace rep str with ' -------------------------------- FUNCTION strRep$(str$,rep$,with$) ln = len(rep$) ln1 = ln - 1 i = 1 while i <= len(str$) if mid$(str$,i,ln) = rep$ then strRep$ = strRep$ + with$ i = i + ln1 else strRep$ = strRep$ + mid$(str$,i,1) end if i = i + 1 WEND END FUNCTION
' -------------------------------------------------- ' Speaks text passed in speak$ ' --------------------------------------------------- [speak] html "<script> speechSynthesis.cancel(u); var u = new SpeechSynthesisUtterance(); u.text = '";speak$;"'; u.lang = 'en-US'; u.rate = 1; speechSynthesis.speak(u); u.onend = function() { speechSynthesis.cancel(u); x = document.getElementById('canMe').click(); } </script>" return
' ----------------------------------------- ' Convert single quotes to double quotes ' ----------------------------------------- FUNCTION dblQuote$(str$) i = 1 qq$ = "" while (word$(str$,i,"'")) <> "" dblQuote$ = dblQuote$;qq$;word$(str$,i,"'") qq$ = "''" i = i + 1 WEND END FUNCTION
|
|