Source code for t-test, chi-square and anova in vbscript (ideally)


I am putting up a site that collects clinical data but the users want to get some simple looks at the data without exporting it to a statsitics package.

Does anyone know where I can get the source code (ideally in vbscript) for a t-test, chi-square and/or ANOVA?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Since you are using vbscript, presumably, you have access to Excel.
If so, why not reference that application in vbs and use its statistcal functions (it has all the ones you need)?

(Note: your Excel app needs the AnalysisToolPak referenced in the Addins collection.)

levinhoAuthor Commented:
I appreciate the suggestion.  How would I go aboput doing that?

Can you point me to an explaination of how to reference Excel using asp?


I don't think you can reference APIs in vbs, but you could wrap this below into a dll, which you could call in vbs

'Module declarations of API functions:
Declare Function FindWindow Lib "user32" Alias _
  "FindWindowA" (ByVal lpClassname As String, ByVal lpWindowName As Long) As Long
Declare Function SendMessage Lib "user32" Alias _
  "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
                  ByVal wParam As Long, lParam As Long) As Long
  Const WM_USER = 1024

Function RefExcelApp () as object

    If AppDetect("Excel") > 0 Then
        Set RefExcelApp = GetObject(, "Excel.Application")
        Set RefExcelApp = CreateObject("Excel.Application")
      End If

End sub

Function AppDetect(strApplicationClassName As String) As Long
'This procedure detects if an app is running and registers it.
  Dim hWnd As Long
  Dim lpClassname As String
  Select Case strApplicationClassName
    Case "CALC"
      lpClassname = "SciCalc"
    Case "NOTEPAD"
      lpClassname = "NOTEPAD"
    Case "EXCEL"
      lpClassname = "XLMAIN"
    Case "WORDPAD"
      lpClassname = "WordPadClass"
    Case "WORD"
      lpClassname = "OpusApp"
    Case "WINHELP"
      lpClassname = "MW_WINHELP"
    Case "PBRUSH"
      lpClassname = "MSPaintApp"
    Case "Explorer"
      lpClassname = "ieframe"
    Case Else
      lpClassname = strApplicationClassName
  End Select
  'This returns a valid handle number, or zero if app is not running
  hWnd = FindWindow(lpClassname, 0)
  AppDetect = hWnd
  If hWnd = 0 Then Exit Function
  SendMessage hWnd, WM_USER + 18, 0, 0   'app is running. Register it in the ROT
End Function


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Math / Science

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.