Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. ################################################################################
  2. ##2a-e
  3. attach(Weibull)
  4. View(Weibull)
  5. HW2A<- Weibull$Values
  6. HW2A
  7. length(HW2A)
  8. ### I assume i will use these to answer part 2c
  9. hist(HW2A)
  10. mean(HW2A)
  11. var(HW2A)
  12. sd(HW2A)
  13. ### this is the distro he wants us to use. the thing i dont know is the shape and scale
  14. ## i just used the defults which are 1. I am not sure because it left skewed if the shape number is different
  15. ## this is my first time with a weibull. The number I get from the weibull what does that mean to me?
  16. ## I am assuming i need the value for the MLE but I am not sure where.
  17. dweibull(100,shape = 1, scale = 1)
  18.  
  19. ###This is where i get stuck because the first homework assignment the MLE did not work for me
  20. ### and i even had my professor help me and we could not get it to work.
  21. ## I am stuck here because I am assuming I am using the mean and sd i collected from above.
  22. ### I am just not sure where the dweibull value goes. I can always email my professor about it.
  23. ## the other thing I do not know is for my optim how do I know what the continous values need to be?
  24.  
  25. NormalMLE <- function(params, data){
  26. mLL <- -1 * sum(log(dnorm(data, mean = params[5], sd = params[3])))
  27. mLL
  28. }
  29. set.seed(5434)
  30. mdl2 <- rnorm(100, mean=5, sd=3)
  31.  
  32. optim(par = c(3,10), fn = NormalMLE, data = s1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement