Question

What is the algorithm of rchisq() function in R?

I am trying to build my myrchisq(), can anyone build the function that will give me the same result as rchisq()?

Note: I don't need ncp = 0

I just need myrchisq = function(n, df){}

Answer #1

I will develop the function using the help of rnorm() function in R. I will assume the non- centrality parameter as 0.

Following is the code. If you run the code, you will get the answer.

###############################################################################

library(MASS)

mychisq=function(sampsize,df)

{

rs=array(dim=1)

for(i in 1:sampsize)

{

x=mvrnorm(1,mu=rep(0,df),Sigma=diag(1,df))

rs[i]=t(x)%*%x

}

return(rs)

}

#To compare mychisq() with rchisq()

par(mfrow=c(1,2))

hist(mychisq(10000,5),freq=F)

hist(rchisq(10000,5),freq=F)

############

After running the code, we will see that both are giving same histogram.

If you do not get anything in this solution, please put a comment and I will help you out. Do not give a downvote instantly. It is a humble request. If you like my answer, please give an upvote.

I am trying to make sense of nearsightedness and farsightedness.
I conducted an experiment in which I determined the focal length in
two corrective lenses. I found that the focal length of the lenses
to correct farsightedness were bigger. I know that convex lenses
are used to correct farsightedness and concave lenses are used to
correct nearsightedness. Can anyone explain to me why my result
makes sense or would be expected? I do not know how to relate my
result...

I am trying to figure out the correct formula in statistics that
I need to use for this question.
When you or anyone else attempts to tell me and my
associates that 1223 persons account for our opinions and tastes
here in America, I get mad as hell! How dare you! When you or
anyone else tells me that 1223 people represent America; it is
astounding and unfair and should be outlawed.
The writer then goes on to claim that...

UNITY QUESTION
I am working with my team in Unity to create a character. I am
responsible for creating a character's moves. Nothing really has
been done yet, but could you provide an example of code using C# or
C++ or even pseudocode
Please provide functions for my character to go walk, run, move
up, move down, move forward, and move backwards.
I will give a thumbs up if it is decent :)
Just give me an example code for...

Here I am upload a My response sheet. you need to Calculate my
total correct and incorrect . And also tell me which number
question need to Objection .
please give correct calculation .
go this link.
Please do not skip with spam . This is not spam just my
query.
https://drive.google.com/file/d/1Fg2r1dM1LUKZo1SzmYtDTCRnUIak7WFN/view?usp=drivesdk

I am having a difficult time understanding what my
professor is looking for in this research paper and he told me to
reread his outline... I am at a loss of how to structure my
research paper and would appreciate some quidence.
Class: Healthcare Informatics
Research paper topic: Information technology in public health
disaster emergencies.
Outline:
-Your task is to produce a review of published literature (at
least 70% of sources to be refereed journal papers, the rest can be...

what would I put in my TI-84 calculator if I am trying to solve
tan(5 degree 35' 22'') and what is the answer?

Looking at my answers, I was am always off buy about range of .1
to .4 from the correct answer that is stated. I am having a really
tough time trying to figure out how to get my number to be exactly
like what is shown as correct so I need a little help with figuring
out what I am doing wrong. Here is an example of a question I just
cant seem to figure out. I'll show all my...

In SPSS, I am reviewing the test of normality. I am trying to
see what is the relationship between age and exercise time. Ages
range from 20 - 24 with 100 participants. I know I need to test for
the dependent variability normality first, with the age being
independent and the exercise time being dependent. I know that
greater than 0.05 is normally distributed and less than 0.05 is not
normally distributed. But lets say four of my age groups...

Having trouble with this lab. This is the table. I am trying to
figure out the final reaction rate. Can someone please do one and
give me a step by step so I can do the rest.
Data Table 1: Varying the
Concentration of 1.0 M HCL
---- C o n c e n t r a t i
o n s ----
#
drops
#
drops
# drops
Initial
Initial
Final
Final
Reaction
Time (sec)
Reaction
Well
#
HCl...

I am trying to figure out how to find the test statistic using
Excel. I understand the formula- that I need to use parameter 'p'
and 'normal distribution' ….z= sample proportion and minus the
'population portion' then we divide p*q and divide n -sample size.
I understand how to populate the data in the formula. I just can't
figure out how to solve this using Excel. (my only option with my
class) I need step by step directions if possible....

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 15 minutes ago

asked 24 minutes ago

asked 26 minutes ago

asked 39 minutes ago

asked 45 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago