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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:30:38+00:00 2026-06-05T22:30:38+00:00

I have the vector d<-1:100 I want to sample k=3 times from this vector

  • 0

I have the vector d<-1:100

I want to sample k=3 times from this vector without replacement. I would like to make elements that are at a distance length(d)/k from the first sampled element to have a higher probability of getting sampled. I am not yet sure how much higher. I know that sample has a prob= argument, however i can’t seem to find a way so that the prob= vectors gets to be recalculated from the location of the initial sample.

Any ideas?

Example:
d<-1:100 . Lets say the first trial samples d[30]=30. Then the elements of ddd that are near 0, 60 and 90 should have a higher probability of sampling. So after the initial sample the the distribution of the sampling probabilities of the rest of the elements of ddd is as in the image: image

  • 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-05T22:30:39+00:00Added an answer on June 5, 2026 at 10:30 pm

    I think:

    samp <- sample(1:100,1)
    prob <- rep(1,100)
    prob[samp]=0
    

    MORE EDIT: I’m an idiot today. Now this will make the probability shape you asked for.

    peke<-c(2,5,7,10,7,5,2)  #your 'triangle' probability
    for (jj = c(0,2,3){
    prob[(1:7)*(1+samp*(jj)] <- peke
    }
    newsamp <-sample(1:100,1,prob)
    

    You may want to add a slight offset if that doesn’t place the probability peaks where you wanted them.

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

Sidebar

Related Questions

Let's say I have this vector v <- c(1:100) And I want to get
I have a vector of pairs representing hops between nodes which I would like
Say I have a vector with 1000 values and I want to 'split/partition/group' this
I have a vector of numbers between 1 and 100(this is not important) which
Basically i have a function that returns a column vector of size Z(100,1) of
I have this project where I want to make the same plots for a
Consider the following: temp <- array(sample(1:100,12), dim=c(365,12)) Depth <- as.vector(seq(1,12,by=1)) time <- seq(from=as.Date(2011-01-01), to=as.Date(2011-12-31),
I have the following code: void foo() { vector<double> v(100,1); // line 1 //
I have vector< pair<int, int>> myVec (N); I want to have all pairs initialized
I have a vector of objects (objects are term nodes that amongst other fields

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.