Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8088721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:10:16+00:00 2026-06-05T19:10:16+00:00

I got the following error: Error 2 Value restriction. The value ‘gbmLikelihood’ has been

  • 0

I got the following error:

Error 2 Value restriction. The value 'gbmLikelihood' has been inferred to have generic type val gbmLikelihood : (float -> '_a -> float [] -> float) when '_a :> seq<float> Either make the arguments to 'gbmLikelihood' explicit or, if you do not intend for it to be generic, add a type annotation.

and this type is exactly what I want. What do I have to do to make it work, and why doesn’t it just work without intervention?

EDIT:
The error comes from this file (its short, so I paste the whole lot):

module Likelihood
open System

let likelihood getDrift getVol dt data parameters =
    let m = getDrift data parameters
    let s =  getVol data parameters
    let N = float (Seq.length data)
    let sqrt_dt = Math.Sqrt dt
    let constant = -0.5*Math.Log(2.0*Math.PI*dt)*N
    let normalizedResidue observation = (observation - (m - 0.5*s*s)*dt)/(s*sqrt_dt) 
    let residueSquared observation = 
        let r = normalizedResidue observation in r*r
    let logStdDev = Math.Log s
    constant - logStdDev*N - 0.5* (data |> Seq.sumBy residueSquared) 

let gbmLikelihood = likelihood (fun data p -> Array.get p 0) (fun datac p -> Array.get p 1)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:10:18+00:00Added an answer on June 5, 2026 at 7:10 pm

    This error can happen when you declare a value that has a generic type. See for example this past SO question. In your case, the type suggests that you are trying to define a function, but the compiler does not see it as a syntactic function. This can happen if you perform some effects and then return function using the lambda syntax:

    let wrong = 
      printfn "test"
      (fun x -> x)
    

    To avoid the problem, you need to write the function using the function syntax:

    printfn "test"
    let wrong x = x
    

    EDIT: In your concrete example, the function gbmLikelihood is created as a result of a partial function application. To make it compile, you need to turn it into an explicit function:

    let gbmLikelihood parameters = 
      likelihood (fun data p -> Array.get p 0) (fun datac p -> Array.get p 1) parameters 
    

    For more information why this is the case & how it works, see also this great article on value restriction in F#.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the following error when executing bulkcopy. System.InvalidOperationException The given value of type
We have a WPF project. I got the following error: InvalidOperationException was unhandled The
While i am trying to get value from arraylist,i got the following errors.My sample
i got following error when i click on mailto: link in colorbox. its work
I got following error... System.NullReferenceException: Object reference not set to an instance of an
This is the second time I got following error for my website: Warning: Fatal
I tried installing TurboGears 1.0 on Windows 7 using tgsetup.py. and got following error
I got the following error in my nusoap file, Notice: Undefined property: nusoapclient::$operation in
I got the following error of Oracle, ORA-25226: dequeue failed, queue string.string is not
On a server running a Qt application I got the following error, as soon

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.