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

  • Home
  • SEARCH
  • 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 773303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:56:34+00:00 2026-05-14T18:56:34+00:00

I ned to implement the multi-linear regression in C#(3.0) by using the LinESt function

  • 0

I ned to implement the multi-linear regression in C#(3.0) by using the LinESt function of Excel.
Basically I am trying to achieve

=LINEST(ACL_returns!I2:I10,ACL_returns!J2:K10,FALSE,TRUE)

So I have the data as below

double[] x1 = new double[] { 0.0330, -0.6463, 0.1226, -0.3304, 0.4764, -0.4159, 0.4209, -0.4070, -0.2090 };
double[] x2 = new double[] { -0.2718, -0.2240, -0.1275, -0.0810, 0.0349, -0.5067, 0.0094, -0.4404, -0.1212 };
double[] y = new double[] { 0.4807, -3.7070, -4.5582, -11.2126, -0.7733, 3.7269, 2.7672, 8.3333, 4.7023 };

I have to write a function whose signature will be

Compute(double[,] x_List, double[] y_List)
{
   LinEst(x_List,y_List, true, true); < - This is the excel function that I will call.
}

My question is how by using double[] x1 and double[] x2 I will make double[,] x_List ?

I am using C#3.0 and framework 3.5.

Thanks in advance

  • 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-05-14T18:56:35+00:00Added an answer on May 14, 2026 at 6:56 pm

    Actually it should be

    double[,] xValues = new double[x1.Length, x2.Length];
    int max = (new int[]{ x1.Length,x2.Length}).Max();
    for (int i = 0; i < max; i++)
    {
    xValues[0, i] = x1.Length > i ? x1[i] : 0;
    xValues[1, i] = x2.Length > i ? x2[i] : 0;
    }
    

    Samir is right, that i should call Max() once outside the iterator rather than each iteration, i’ve amended this.

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

Sidebar

Ask A Question

Stats

  • Questions 427k
  • Answers 427k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer :map <C-Right> <End> :map <C-Left> <Home> :map <C-Down> <PageDown> :map… May 15, 2026 at 12:54 pm
  • Editorial Team
    Editorial Team added an answer Unfortunately there is not an easy way to do this.… May 15, 2026 at 12:54 pm
  • Editorial Team
    Editorial Team added an answer Hi brux to avoid UI locks up use AsyncTask, you… May 15, 2026 at 12:54 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.