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 8555255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:04:57+00:00 2026-06-11T15:04:57+00:00

I am making a tree which will eventually turn into a set of arms

  • 0

I am making a tree which will eventually turn into a set of arms with probabilities attached to going down each arm, with a value at the end of each arm.

This is the final arm of me tree (I am building it backwards).

require(mc2d)
ndvar(1000)

sderror_dfail<-(0.30-0.86)/1.96
alpha_dfail<-0.62*{{0.62*{1-0.62}/{sderror_dfail*sderror_dfail}}-1}
beta_dfail<-alpha_dfail*{{1-0.62}/0.62}

probs_d_if_fail<-mcstoc(rbetagen,type="V",shape1=alpha_dfail, shape2=beta_dfail, 
min=0, max=1)

lots1<-mcdata(1)
test<-lots1-probs_d_if_fail

probs1 <- mcstoc(rempiricalD, values=1:2, type="V", prob= c(probs_d_if_fail,test))

The next step is to build a branch of a tree as follows:

node1 <- mcprobtree(probs1, list("1"=mcdata(0), "2"=mcdata(1), type="V")

However the line probs1<- mcstoc(….) when I run it gives me the following error

Error in function (n, values, prob = NULL)  : 
Prob and values should be of same length or have the same number of columns.

I get the feeling it doesn’t like me using mcstoc object as the prob=c(probs_d_if_fail,test) part of the equation, but am not sure how to work around this.

Any help would be greatly appreciated.

Timothy

  • 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-11T15:04:58+00:00Added an answer on June 11, 2026 at 3:04 pm

    rempiricalD requires a a multivariate mcnode as prob argument. This is tricky.

    Try:

    require(mc2d)
    ndvar(10000)
    
    sderror_dfail<-(0.30-0.86)/1.96
    alpha_dfail<-0.62*{{0.62*{1-0.62}/{sderror_dfail*sderror_dfail}}-1}
    beta_dfail<-alpha_dfail*{{1-0.62}/0.62}
    
    probs_d_if_fail<-mcstoc(rbetagen,type="V",shape1=alpha_dfail, shape2=beta_dfail, 
    min=0, max=1)
    
    lots1<-mcdata(1)
    test<-lots1-probs_d_if_fail
    probs <- mcdata(c(probs_d_if_fail,test),type="V",nvariates=2)
    probs1 <- mcstoc(rempiricalD, values=1:2, type="V", prob= probs)
    
    node1 <- mcprobtree(probs1, list("1"=mcdata(0), "2"=mcdata(1)), type="V")
    node1
    

    But the following code might be simpler if it fits your needs:

    require(mc2d)
    ndvar(10000)
    
    sderror_dfail<-(0.30-0.86)/1.96
    alpha_dfail<-0.62*{{0.62*{1-0.62}/{sderror_dfail*sderror_dfail}}-1}
    beta_dfail<-alpha_dfail*{{1-0.62}/0.62}
    
    probs_d_if_fail<-mcstoc(rbeta,type="V",shape1=alpha_dfail,
    shape2=beta_dfail)
    
    node1 <- mcstoc(rbern, type="V",prob = 1-probs_d_if_fail)
    node1
    

    Note that rbern will provide a 1 with probability (1-probs_d_if_fail), as you need if I understand well.

    RP

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

Sidebar

Related Questions

Making a word document of our network set-up. We have about 7 servers and
Making an adobe flex ui in which data that is calculated must use proprietary
Making a drop down list for my JSP and the values I'm entering won't
I have a warehouse in which I keep goods. Each article occupies given volume
I am making a python tree visualizer using wxPython. It would be used like
I have a Menu object (set as the DataContext) which contains many Options (Menu.Options)
i am making a tree with the help javascript and jquery . I the
I have 3 different classes Tree , Fruit , and Basket . Each of
I'm creating a program in Java which contains a tree-structure of objects. All classes
I'm in the design stage for an app which will utilize a REST web

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.